cdsutils import fail from node code
With an
import cdsutils
At the start of my Guardian state code on 1.0.5 I'm getting an import error
[controlsP50 guardian]$guardian SQZ_OPO
Traceback (most recent call last):
File "/bin/guardian", line 9, in <module>
load_entry_point('guardian==1.0.5', 'console_scripts', 'guardian')()
File "/usr/lib/python2.7/site-packages/guardian/__main__.py", line 130, in main
system = cli.init_system(args, load=True)
File "/usr/lib/python2.7/site-packages/guardian/cli.py", line 50, in init_system
sys.load()
File "/usr/lib/python2.7/site-packages/guardian/system.py", line 400, in load
module = self._load_module()
File "/usr/lib/python2.7/site-packages/guardian/system.py", line 288, in _load_module
self._module = self._import(self._modname)
File "/usr/lib/python2.7/site-packages/guardian/system.py", line 162, in _import
module = _builtin__import__(name, globals, locals, fromlist, level=level)
File "/opt/rtcds/userapps/cds_user_apps/trunk/sqz/m1/guardian/SQZ_OPO.py", line 9, in <module>
import cdsutils
File "/usr/lib/python2.7/site-packages/guardian/system.py", line 162, in _import
module = _builtin__import__(name, globals, locals, fromlist, level=level)
File "/usr/lib/python2.7/site-packages/cdsutils/__init__.py", line 1, in <module>
from _version import __version__
File "/usr/lib/python2.7/site-packages/guardian/system.py", line 162, in _import
module = _builtin__import__(name, globals, locals, fromlist, level=level)
ImportError: No module named _version
Other imports do no seem to trigger it. If I modify this init.py file of cdsutils to read
from ._version import __version__
instead of
from _version import __version__
the import error is fixed (actually just moves to another import line with a similar error). Looks like the monkeypatched import code is not distinguishing the two kinds of imports in py2.7 quite right.