小编And*_*rew的帖子

ImportError:在使用virtualenv的PyCharm下没有名为test_data的模块,但是test_data.py与test.py在同一目录中

在test.py中,我试图导入test_data:

import unittest2
import re

from test_data import receipt1_example
Run Code Online (Sandbox Code Playgroud)

test_data.py与test.py位于同一目录中.我收到以下错误:

/Users/ahammond/.virtualenvs/ric2.6/bin/python2.6 /Applications/PyCharm.app/helpers/pycharm/utrunner.py /Users/ahammond/src/hackfest_spring_2012/parse_me/test.py::test true Testing上午11:30开始... Traceback(最近一次调用最后一次):
文件"/Applications/PyCharm.app/helpers/pycharm/utrunner.py",第121行,在module = loadSource(a [0])文件中/Applications/PyCharm.app/helpers/pycharm/utrunner.py",第44行,在loadSource模块中= imp.load_source(moduleName,fileName)文件"/Users/ahammond/src/hackfest_spring_2012/parse_me/test.py",行4,从test_data导入receipt1_example ImportError:没有名为test_data的模块

进程以退出代码1结束

如您所见,我使用virtualenv在pycharm下运行它.这是配置的屏幕截图:

PyCharm调试配置

python import virtualenv pycharm unittest2

6
推荐指数
1
解决办法
7074
查看次数

使用GitPython,我该怎么做git子模块更新--init

到目前为止,我的代码正在执行以下操作.我想摆脱subprocess.call()的东西

import git
from subprocess import call

repo = git.Repo(repo_path)
repo.remotes.origin.fetch(prune=True)
repo.head.reset(commit='origin/master', index=True, working_tree=True)

# I don't know how to do this using GitPython yet.
os.chdir(repo_path)
call(['git', 'submodule', 'update', '--init'])
Run Code Online (Sandbox Code Playgroud)

python gitpython

2
推荐指数
1
解决办法
3842
查看次数

标签 统计

python ×2

gitpython ×1

import ×1

pycharm ×1

unittest2 ×1

virtualenv ×1