cx_freeze: carácter no válido en el identificador

the cx_freeze notes error:

module.code = compile(codeString, path, "exec
  File "update.py", line 1
    \ufeffimport os
            ^
SyntaxError: invalid character in identifier

cx_freeze version: cx_Freeze-4.2.3.win32-py3.1 , python version:python-3.1.3**

no matter using the comand or step.py to compile this code,it always note the err:"invalid character in identifier".I had delete all character which wasn't English.and the file path was English too. ps:I have tried to compile a "helloWorld.py",it succeed.

please help me,I'm a fresh learning python.

the code was used to copy some files to the path I write in the config file. and the code runing no error.

preguntado el 01 de julio de 12 a las 16:07

the error is in update.py file, did you remove invalid characters from that file? -

¿Tiene su import os line have a unicode space in front of it? -

to Ashwini Chaudhary :yes i did -

1 Respuestas

0xfeff is a Unicode byte order mark. Save update.py as UTF-8 without a byte order mark. (UTF-8 should not have a BOM to begin with, but some editors add one anyway.)

Respondido 01 Jul 12, 17:07

i copy the code to a new file and compile,it succeed. thank you! - mrchen

but when i runing the exe file,it traceback: File "C:\Python31\lib\encodings\ascii.py", line 26, in decode UnicodeDecodeError: 'ascii' codec can't decode byte 0xd7 in position 2: ordinal not in range(128) my python installed in d: - mrchen

why the exealble file go c: to search the encoding package.i compile it by using the comand"csfreeze --target-dir dist". is there anyother way to do that, and will not search the encoding package in c: ?? - mrchen

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.