我有一个文件gufu.py
,它大约有4个函数:
def parse1():
...
def parse2():
...
def parse3():
...
def parse4():
...
但是当我通过python
shell运行以下命令时:
不过,我是从同一个目录运行python
。
我通过:import os; os.chdir("/path/to/thefile"); os.getcwd()
也是。
更新
>>> 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']
问:有人能帮我理解为什么这不起作用吗?在
目前没有回答
相关问题 更多 >
编程相关推荐