"ValueError: Empty module name" on basic import

alain MONTMORY Alain.montmory at thalesgroup.com
Fri Sep 29 08:25:25 EDT 2006


Hello everybody,

I am a newbie to python so I hope I am at the right place to expose my 
problem..... :-[

I am working on linux mandrake 10.1 with python :
python -V
Python 2.3.4
I am trying o run the example which stay in the documentation in paragraph
http://www.python.org/doc/2.4.2/ext/pure-embedding.html 5.3 Pure Embedding
I download the code example from
http://www.python.org/doc/2.4.2/ext/run-func.txt
I call the file "TestOfficiel.c" and I compile it with :
gcc -g -I/usr/include/python2.3/ TestOfficiel.c -o TestOfficiel 
-lpython2.3 -ldl
all is OK (or seems to be...).
as stated in the documentation  I creat a file "TestPythonFoo.py" which 
contain
"
def multiply(a,b):
    print "Will compute", a, "times", b
    c = 0
    for i in range(0, a):
        c = c + b
    return c
"
I launch
./TestOfficiel ./TestPythonFoo.py multiply 3 2
and as a result :
ValueError: Empty module name
Failed to load "./TestPythonFoo.py"
if I try an absolute path to the python file :
./TestOfficiel `pwd`/TestPythonFoo.py multiply 3 2
I obtain :
ImportError: No module named 
/space/ESOPPE_PROJET/Outils/SwigPython/swigCallPython/TestPythonFoo.py
Failed to load 
"/space/ESOPPE_PROJET/Outils/SwigPython/swigCallPython/TestPythonFoo.py"
Of course the file exist :
[montmory at esoppe1 swigCallPython]$ ll 
/space/ESOPPE_PROJET/Outils/SwigPython/swigCallPython/TestPythonFoo.py
-rwxrwx--x  1 montmory esoppe 126 sep 29 14:04 
/space/ESOPPE_PROJET/Outils/SwigPython/swigCallPython/TestPythonFoo.py*

I found lot of post about "ValueError: Empty module name" but no clear 
solution (clear for me...).
What's wrong ?
my python version?
Additionnal informations :
gcc version 3.4.1 (Mandrakelinux 10.1 3.4.1-4mdk)

Thanks for your help,

best regards,

Alain



-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: TestOfficiel.c
URL: <http://mail.python.org/pipermail/python-list/attachments/20060929/64209753/attachment.c>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: TestPythonFoo.py
URL: <http://mail.python.org/pipermail/python-list/attachments/20060929/64209753/attachment.ksh>


More information about the Python-list mailing list