I'm using Max OS X 10.10.3, and I finally got the graphics.py
to show in Python 3, before it was saying no module existed.
However, now when I try import graphics
, or from graphics import *
, I get the message:
"source code string cannot contain null bytes"
Does any Mac user (using Python 3) perhaps know what is wrong? Has anyone used the Zelle book and his graphics.py
module? Thanks.
For posterity: I had the same problem and fixed it using,
sed -i 's/\x0//g' FILENAME
The file seemed to be messed up in numerous ways (wrong endings, etc); no idea how...
See https://stackoverflow.com/a/2399817/230468
This kind of error is not from your project source code. This kind of error emerges from your python interpreter. So the best solution is to set your python interpreter in your project env directory. or set the interpreters virtual env properly using your IDE's interpreter configuration.
I've got the same error and the solution is to uninstall the Library and if you can't simply delete it and reinstall the Library. should work it has work for me...
I just encountered this problem, which is usually caused by the encoding format. You can use Notepad++ to change the encoding format of python files to UTF-8.