小编Man*_*Dee的帖子

为什么readline.read_history_file给我'IOError:[Errno 2]没有这样的文件或目录'

我的Python历史文件存在于〜/ .pyhistory中,包含以下内容:

from project.stuff import *
quit()
from project.stuff import *
my_thing = Thing.objects.get(id=21025)
my_thing
my_thing.child_set.all()
my_thing.current_state
my_thing.summary_set
my_thing.summary_set.all()
[ x.type for x in my_thing.child_set.all() ]
[ x.type for x in my_thing.child_set.all().order_by( 'datesubmitted' ) ]
quit()
Run Code Online (Sandbox Code Playgroud)

我正在使用virtualenv和virtualenvwrapper来构建虚拟环境.今天我遇到了readline没有在我的历史文件中读取的问题:

>>> historyPath
'/Users/johndoe/.pyhistory'
>>> readline.read_history_file(historyPath)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 2] No such file or directory
Run Code Online (Sandbox Code Playgroud)

该文件是可读写的:

[johndoe@here]# ls -l ~/.pyhistory
-rw-------  1 johndoe  somegroup  325 21 Sep  2012 /Users/johndoe/.pyhistory
Run Code Online (Sandbox Code Playgroud)

什么可能导致这个问题?

python readline python-2.7

3
推荐指数
1
解决办法
1652
查看次数

标签 统计

python ×1

python-2.7 ×1

readline ×1