On 11/29/2010 09:15 PM, Karim wrote:
Hello every one,
I created a package with the following structure:
* ops/
o __init__.py
o tcl/
+ __init__.py
+ pythontcl.py
> *python -c "import sys; print sys.path; import ops.tcl.pythontcl"*
['',
'/usr/local/lib/python2.6/dist-packages/pyparsing-1.5.5-py2.6.egg',
'*/home/karim/build/UML2PDK/lib/python*', '/usr/lib/python2.6',
'/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk',
'/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload',
'/usr/lib/python2.6/dist-packages',
'/usr/lib/python2.6/dist-packages/PIL',
'/usr/lib/python2.6/dist-packages/gst-0.10',
'/usr/lib/pymodules/python2.6',
'/usr/lib/python2.6/dist-packages/gtk-2.0',
'/usr/lib/pymodules/python2.6/gtk-2.0',
'/usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode',
'/usr/local/lib/python2.6/dist-packages']
/*home/karim/build/UML2PDK/lib/python/ops/tcl/pythontcl.py:109:
RuntimeWarning: Parent module 'pythontcl' not found while handling
absolute import
import unittest
/home/karim/build/UML2PDK/lib/python/ops/tcl/pythontcl.py:110:
RuntimeWarning: Parent module 'pythontcl' not found while handling
absolute import
import sys*
At the lines I import standard modules sys and unittest I get these
non-sense warning (my consideration) though I added the top package
root, namely, */home/karim/build/UML2PDK/lib/python. The
programesecute correctly but I alaways get this nerving warning.
*Any idea will be welcome!* :-)
*Regards
Karim*
*
I believed I know why:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/karim/build/UML2PDK/lib/python/ops/tcl/pythontcl.py",
line 119, in <module>
print sys.modules[__package__]
KeyError: 'pythontcl'
It is due to method determine parent in class ModuleImporter.
I don't know why sys.modules has the key 'ops.tcl.pythontcl'
and this class search for the key module 'pythontcl'.
Big mess between relative path or whatever.
Any idea to fix that?
Karim
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor