WingIDE C:\Python27 __init__.py" raise CodecRegistryError SyntaxError: invalid syntax

10,701

Solution 1

This occurs because you have an environment variable that refer to another Python version which is not the version you're using right now.

This how to fix this issue:

In a terminal window (cmd.exe), try the this command:

set | findstr /i python

If you get an output like this, Path=C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLSClient\;C:\csvn\bin\;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system 32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Java\jdk1.8.0_101\bin;C:\Apache\apache-ant-1.10.1\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;D:\Acedemic\Open Source Project\10.11\bin;C:\Program Files\Git\cmd;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Skype\Phone\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Users\Rajitha\AppData\Local\Programs\Python\Python36-32;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Users\Rajitha\AppData\Local\Microsoft\WindowsApps; PYTHONHOME=C:\csvn\Python25\*

Remove the "PYTHONHOME" environmental variable.

If you get an output like this,C:\Users\Acebulf>set | findstr /i python Path=C:\Python27\Lib\site-packages\PyQt4;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System2\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Microsoft SQL Server\1 10\Tools\Binn\;C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\;C:\Program Files\In tel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Python27\ PYTHONPATH=C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk;

Remove the "PYTHONPATH" environmental variable.

This should fix the error!

Solution 2

It may be because you have different versions of Python installed, and you are using one version's interpreter with another version's libraries. If running under Windows, check your environment settings.

Share:
10,701
user4352158
Author by

user4352158

Updated on July 23, 2022

Comments

  • user4352158
    user4352158 almost 2 years

    I had a program that ran successfully in PyCharm. I then just installed Wing IDE and tried to run that same program, but now I get the error

    C:\Python27\Lib\encodings\__init__.py", line 123
    
    raise CodecRegistryError,\
                             ^ SyntaxError: invalid syntax
    

    Can anyone help with this?