I have a python file, [working dir/]modules/commands.py , which contains only the following:
def getId(): return "commands"
Then I have another [working dir/]main.py that uses the following:
fpath = "modules/commands.py" mname = "commands" imp.load_source(mname, fpath)
After adding getId() to commands.py I started getting the following error when trying to run main.py :
SyntaxError: Non-ASCII character '\xd1' in file modules/commands.pyc on line 1, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
The error is related to non-ascii characters, but there should not be any in the file. What causes the error?
Edit: The problem disappears temporarily if I delete the .pyc file, but returns the next time.
source share