【发布时间】:2011-03-31 17:02:24
【问题描述】:
EDIT-4
我已经执行了我的 sitecustomize.py,但它抛出了一个错误。 Here's the code 为它。
错误是:
Error in sitecustomize; set PYTHONVERBOSE for traceback:
RuntimeError: maximum recursion depth exceeded while calling a Python object
我对 Python 的使用还不是很先进,所以我想我只会注释掉我认为不需要的行。没有出现编码问题,所以我只是注释掉了第 23-104 行,但这也没有帮助。
EDIT-3
我也碰巧安装了 2.5.1,所以我用它编译了另一个脚本。
print 'This will test carriage returns on Windows with PyDev on Eclipse Helios'
print'Type something:',
test = raw_input()
print('You entered the following ascii values:')
for c in test:
print(str(ord(c)))
这运行良好,并导致
This will test carriage returns on Windows with PyDev on Eclipse Helios
Type something: g
You entered the following ascii values:
103
所以这可能只是 Python3 的事情?我知道它不是解释器,因为我能够在命令提示符下运行它就好了。什么给了?
EDIT-2
刚刚用 Helios 测试过,仍然有同样的问题。这是我的测试程序:
print('This will test carriage returns on Windows with PyDev on Eclipse Helios.')
print('Type something:', end='')
test = input()
print('You entered the following ascii values:')
for c in test:
print(str(ord(c)))
这是我输入“g”并按 Enter 时的输出:
This will test carriage returns on Windows with PyDev on Eclipse Helios.
Type something:g
You entered the following ascii values:
103
13
从总体上看,这是一个小问题。我可以使用 input().rstrip() 并且它有效。但解决方法甚至不应该是必要的。我用我正在使用的语言输入的字数是我应该输入的两倍,因为它简洁漂亮。
EDIT-1
这是 Eclipse 3.5。不幸的是,这是已获准在工作中使用的最新版本。我打算在家里尝试 3.6 看看有什么不同,但无论如何我都无法使用它。
(原始问题)
我一直在学习一些基本的 Python,并决定使用 PyDev,因为它支持 Python 3 以及所有漂亮的代码 sn-p 和自动完成功能。
但是,我在 Windows 上遇到了该死的回车问题。
我的搜索总是让我回到这个邮件列表: http://www.mail-archive.com/python-list@python.org/msg269758.html
所以我抓取了 sitecustomize.py 文件,尝试将它包含在我配置的解释器的 Python 路径中,以及我的项目中,但无济于事。
还有其他人设法解决这个问题吗?或者可能知道如何让新的 sitecustomize.py 实际执行,以便它可以覆盖 input() 和 raw_input()?
我知道我总是可以用我自己的替换 input() 函数制作一个简短的模块,但我真的很想从根本上解决问题。 Aptana 承认了这个问题 (http://pydev.org/faq.html#why_raw_input_input_does_not_work_correctly),但没有提供任何解决方案。提前感谢您的帮助。
【问题讨论】:
标签: python windows eclipse pydev carriage-return