Python:cTurtle模块没有加载

时间:2012-10-20 12:52:28

标签: python python-3.x

帮助我无法加载cTurtle。我收到以下错误

>>> import cTurtle
Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
    import cTurtle
TypeError: source code string cannot contain null bytes

我已将模块保存在以下目录中: C:\Python33\Lib\site-packages

还有其他我想念的东西,对不起,如果这是一个非常新的问题,但我想玩这个模块。我正在使用python 3.3。

由于

2 个答案:

答案 0 :(得分:1)

python3.3出现错误,但python3.2出现错误。

由于某种原因,cTurtle.py的第41行在该行的末尾包含一个NULL-charachter:

$ od -t a cTurtle.py.orig | grep -i nul

0003360    -   -   -   -  sp   c   T   u   r   t   l   e   .   p   y nul

删除NULL字符,模块应该可以正常工作。

答案 1 :(得分:0)

我以UTF8保存文件,错误消息消失