Code Monkey home page Code Monkey logo

Comments (7)

bnjmnp avatar bnjmnp commented on August 16, 2024

Hi Gabriel,

not sure which OS you are using for the pi (I guess its the Raspberry Pi OS), but if you have internet access you could install pysoem from PyPI via python3 -m pip install pysoem. It might be required to install Cython beforehand via python3 -m pip install Cython.
If you like to install pysoem from the sources you should know that you need to clone the repo recursively via git clone --recursive https://github.com/bnjmnp/pysoem.git. With the sources there you install the package via python3 setup.py install.

I recommend to use virtualenv for trying things out:

  • python3 -m pip install virtualenv installs virtualenv
  • with python3 -m virtualenv venv you creat a "virtualenv"
  • with source venv/bin/activate you activate the virtualenv
  • you now can use python3 and install packages as it would be your systems Python but you can remove the virtualenv by deleting the venv directory without any harm to the systems Python interpreter. You also have less access violation issues.

from pysoem.

GabrielGomesBarbosa avatar GabrielGomesBarbosa commented on August 16, 2024

Hi @bnjmnp

Yes i'm using Raspberry PI OS, thanks for your tips... i will use the virtualenv.

If i do this... i will be able to run the minimal_example.py ? when i ran this this example with python mininal_example.py i get this message on console: usage: basic_example ifname

    if len(sys.argv) > 1:
        try:
            BasicExample(sys.argv[1]).run()
        except BasicExampleError as expt:
            print('basic_example failed: ' + expt.message)
            sys.exit(1)
    else:
        print('usage: basic_example ifname')
        sys.exit(1)

because i dont send args... my question is:

If i use virtualenv will solve it ?
Which argument i need to pass to execute minimal_example.py ?

from pysoem.

bnjmnp avatar bnjmnp commented on August 16, 2024

You need to give the ID of your network interface. Sure your Pi only has one, but other systems may have more. In your case its probably eth0 so you do python3 minimal_example.py eth0.
You get a list of available interfaces by calling the ifconfig in the terminal. Also pysoem/examples/find_adapters.py should give you the same list.
The virtualenv is not neede for this.

from pysoem.

GabrielGomesBarbosa avatar GabrielGomesBarbosa commented on August 16, 2024

@bnjmnp thanks for your support, i will test it... and after the test, i will back here to tell the result.

from pysoem.

GabrielGomesBarbosa avatar GabrielGomesBarbosa commented on August 16, 2024

Hi @bnjmnp i have new question...

Look, i still not have a slave machine to test (but i will have one very soon), so for while i'm testing in my home with standard Ethernet port, without W5500 Ethernet Shield...

I ran the find_adaters.py and i get this list:

2020-10-25-234133_1920x1080_scrot

After that i choose the adapter eth0, and i get this message:

2020-10-25-234414_1920x1080_scrot

My question is:

Shouldn't I get a message saying "No slaves found" ? or this error is normal because i don't have a slave connected ?

PS1: Sorry for these question... i really new in the Ethercat connection.
PS2: I still using Python 2.7 because i trying to update to Python 3.8, or this version can cause this error?

UPDATE

Now i follow this steps:

  1. Install pysoem using python3.
  2. Install Cython using python3.
  3. Clone this repository recusive git clone --recursive https://github.com/bnjmnp/pysoem.git.
  4. Execute setup.py install --root using python3.

After that i back on examples and i ran find_adapters.py and minimal_example.py using python3 and now i get this:

2020-10-26-000725_1920x1080_scrot

That's correct ? because i dont have anything connected ?

from pysoem.

bnjmnp avatar bnjmnp commented on August 16, 2024

Yes the error "ConnectionError not found" is related to using Python 2, as the built-in exception ConnectionError came first up with Python 3.

I guess the "could not open interface eth0" error is thrown because you need root access to open eth0 for raw ethernet communication. So try to do sudo python3 minimal_example.py eth0.

from pysoem.

GabrielGomesBarbosa avatar GabrielGomesBarbosa commented on August 16, 2024

@bnjmnp Thanks, now its working "Slaves not found".

2020-10-28-135641_1920x1080_scrot

from pysoem.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.