mbuesch / pyprofibus

PROFIBUS-DP stack
https://bues.ch/a/profibus
GNU General Public License v2.0
134 stars 52 forks source link

No module named 'pyprofibus.gsd' #1

Closed sstickel closed 7 years ago

sstickel commented 7 years ago

When trying to import pyprofibus this error pops up:

Python 3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information.

import pyprofibus Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.5/dist-packages/pyprofibus/init.py", line 4, in from pyprofibus.conf import * File "/usr/local/lib/python3.5/dist-packages/pyprofibus/conf.py", line 14, in from pyprofibus.gsd.interp import GsdInterp ImportError: No module named 'pyprofibus.gsd'

Steps I did

clone pyprofibus, then run ./setup.py install When I stay on the same console and open a python interpreter I am able to import pyprofibus. When I try the same in another console or from pyCharms it throws the above error

Same happens when trying to use awlsim with pyprofibus. (When hitting Download source)

sstickel commented 7 years ago

It is really strange, I dont get it at all. Manually uninstalled all pyprofibus related stuff in /usr/local/lib, and ran an install for python2 only. On the actual console python3 does not throw an error if I try to import afterwards, but there is no pyprofibus installed for 3.5. When I then open a new console windows it throws.

System is Kubuntu 16.04

` mel@here: ~/localgit/pyprofibus $ sudo python2 setup.py install [sudo] Passwort für me:
running install
running build
running build_py
running build_scripts
running install_lib
creating /usr/local/lib/python2.7/dist-packages/pyprofibus
copying build/lib.linux-x86_64-2.7/pyprofibus/phy.py -> /usr/local/lib/python2.7/dist-packages/pyprofibus
copying build/lib.linux-x86_64-2.7/pyprofibus/dp_master.py -> /usr/local/lib/python2.7/dist-packages/pyprofibus
copying build/lib.linux-x86_64-2.7/pyprofibus/fdl.py -> /usr/local/lib/python2.7/dist-packages/pyprofibus
copying build/lib.linux-x86_64-2.7/pyprofibus/version.py -> /usr/local/lib/python2.7/dist-packages/pyprofibus
copying build/lib.linux-x86_64-2.7/pyprofibus/phy_serial.py -> /usr/local/lib/python2.7/dist-packages/pyprofibus
copying build/lib.linux-x86_64-2.7/pyprofibus/phy_dummy.py -> /usr/local/lib/python2.7/dist-packages/pyprofibus
copying build/lib.linux-x86_64-2.7/pyprofibus/conf.py -> /usr/local/lib/python2.7/dist-packages/pyprofibus
copying build/lib.linux-x86_64-2.7/pyprofibus/init.py -> /usr/local/lib/python2.7/dist-packages/pyprofibus
copying build/lib.linux-x86_64-2.7/pyprofibus/util.py -> /usr/local/lib/python2.7/dist-packages/pyprofibus
copying build/lib.linux-x86_64-2.7/pyprofibus/dp.py -> /usr/local/lib/python2.7/dist-packages/pyprofibus
copying build/lib.linux-x86_64-2.7/pyprofibus/compat.py -> /usr/local/lib/python2.7/dist-packages/pyprofibus
byte-compiling /usr/local/lib/python2.7/dist-packages/pyprofibus/phy.py to phy.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pyprofibus/dp_master.py to dp_master.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pyprofibus/fdl.py to fdl.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pyprofibus/version.py to version.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pyprofibus/phy_serial.py to phy_serial.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pyprofibus/phy_dummy.py to phy_dummy.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pyprofibus/conf.py to conf.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pyprofibus/init.py to init.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pyprofibus/util.py to util.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/pyprofibus/dp.py to dp.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/pyprofibus/compat.py to compat.pyc running install_scripts copying build/scripts-2.7/pyprofibus-linuxcnc-hal -> /usr/local/bin changing mode of /usr/local/bin/gsdparser to 755 changing mode of /usr/local/bin/pyprofibus-linuxcnc-hal to 755 changing mode of /usr/local/bin/profisniff to 755 running install_egg_info Writing /usr/local/lib/python2.7/dist-packages/pyprofibus-1.2.egg-info me@here: ~/localgit/pyprofibus $ python2 Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import pyprofibus

me@here: ~/localgit/pyprofibus $ python3 Python 3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. import pyprofibus from pyprofibus import *

me@here: ~/localgit/pyprofibus $ ll /usr/local/lib/python3.5/dist-packages/pyprofi ls: Zugriff auf '/usr/local/lib/python3.5/dist-packages/pyprofi' nicht möglich: Datei oder Verzeichnis nicht gefunden me@here: ~/localgit/pyprofibus $ `

mbuesch commented 7 years ago

Fixed by https://github.com/mbuesch/pyprofibus/pull/2 Thanks for your bug report