I have a file gufu.py
, which has about 4 functions:
def parse1():
...
def parse2():
...
def parse3():
...
def parse4():
...
but when I run the following in python
shell via:
>>> from gufu import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'gufu'
Although, I am running
python
from the same directory.I'm VERIFYING that I am in the same directory as the file via:
import os; os.chdir("/path/to/thefile"); os.getcwd()
as well.
UPDATE
>>> import os; os.chdir("/thepath/to/the/file")
>>> os.getcwd()
'/thepath/to/the/file'
>>> from gufu import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'gufu'
>>> os.path.isfile('gufu.py')
False
>>> os.getcwd()
'/thepath/to/the/file'
>>> os.listdir()
['tests', 'urls.py', '__init__.py', 'models.py', 'tests.py', 'views.py', 'database.py', 'models.py.bak', 'hashers.py', 'apps.py', 'injection__backup.py', '__pycache__', 'urldata.py', 'Injection.py', 'gufu.py', 'Xss.py', 'templates', 'helpers', 'migrations', 'forms.py', 'models.bakFULLTBL', 'static', 'admin.py']
Q: Can someone please help me understand why this is not working?