L
linuxnow
I don't know what I'm doing wrong, but the result is that _import_ only
works from a python shell, but not when I call a python script.
$ cat test.py
mod = __import__("/home/me/tests/test_imp")
Called from a script it does not work:
$ python /home/me/test.py
Traceback (most recent call last):
File "/home/pau/test.py", line 1, in ?
mod = __import__("/home/me/tests/test_imp")
ImportError: No module named /home/me/tests/test_imp
But if I import it from a python shell, then no problem:
$ python
What am I doing wrong?
works from a python shell, but not when I call a python script.
$ cat test.py
mod = __import__("/home/me/tests/test_imp")
Called from a script it does not work:
$ python /home/me/test.py
Traceback (most recent call last):
File "/home/pau/test.py", line 1, in ?
mod = __import__("/home/me/tests/test_imp")
ImportError: No module named /home/me/tests/test_imp
But if I import it from a python shell, then no problem:
$ python
What am I doing wrong?