Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spyder 5.4.1 won't load in case of Windows environment variable with non-ASCII character #20348

Closed
8 of 10 tasks
alessandro-soldati opened this issue Jan 10, 2023 · 3 comments
Closed
8 of 10 tasks

Comments

@alessandro-soldati
Copy link

alessandro-soldati commented Jan 10, 2023

Issue Report Checklist

  • Searched the issues page for similar reports
  • Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
  • Reproduced the issue after updating with conda update spyder (or pip, if not using Anaconda) [this caused the issue to appear!]
  • Could not reproduce inside jupyter qtconsole (if console-related) [not applicable]
  • Tried basic troubleshooting (if a bug/error)
    • Restarted Spyder
    • Reset preferences with spyder --reset
    • Reinstalled the latest version of Anaconda [na: using pip or standalone]
    • Tried the other applicable steps from the Troubleshooting Guide
  • Completed the Problem Description, Steps to Reproduce and Version sections below

Problem Description

On Windows 10, after updating from Spyder 5.4.0 to 5.4.1, if there exist any Windows environment variable with non-ASCII characters (e.g. accented letters), Spyder starts the splash screen, then it disappears and does not open.
Running from console, results in UnicodeDecodeError in parsing the environment variable as read from stdout.
Removing the environment variable with non-ASCII chars solves the issue.

What steps reproduce the problem?

  1. Add (if not already present) any Windows environment variable with a non-ASCII character. E.g. ASD = à. My system is using CP850, not sure if all codepages can reproduce the issue.
  2. Start Spyder (from Start menu or cmd or Powershell).
  3. Spyder spash screen appears and then disappears, Spyder does not load.

What is the expected output? What do you see instead?

Expected: Spyder opens.
Achieved: Spyder spash screen disappears, Spyder not loaded.

Paste Traceback/Error Below (if applicable)

C:\Users\alex8>python C:\Users\alex8\AppData\Local\Programs\Python\Python311\Lib\site-packages\spyder\app\start.py
fromIccProfile: failed minimal tag size sanity
Traceback (most recent call last):
  File "C:\Users\alex8\AppData\Local\Programs\Python\Python311\Lib\site-packages\spyder\app\start.py", line 270, in <module>
    main()
  File "C:\Users\alex8\AppData\Local\Programs\Python\Python311\Lib\site-packages\spyder\app\start.py", line 252, in main
    mainwindow.main(options, args)
  File "C:\Users\alex8\AppData\Local\Programs\Python\Python311\Lib\site-packages\spyder\app\mainwindow.py", line 1822, in main
    mainwindow = create_window(MainWindow, app, splash, options, args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\alex8\AppData\Local\Programs\Python\Python311\Lib\site-packages\spyder\app\utils.py", line 289, in create_window
    main.setup()
  File "C:\Users\alex8\AppData\Local\Programs\Python\Python311\Lib\site-packages\spyder\app\mainwindow.py", line 773, in setup
    PLUGIN_REGISTRY.register_plugin(self, PluginClass,
  File "C:\Users\alex8\AppData\Local\Programs\Python\Python311\Lib\site-packages\spyder\api\plugin_registration\registry.py", line 342, in register_plugin
    instance = self._instantiate_spyder5_plugin(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\alex8\AppData\Local\Programs\Python\Python311\Lib\site-packages\spyder\api\plugin_registration\registry.py", line 184, in _instantiate_spyder5_plugin
    plugin_instance = PluginClass(main_window, configuration=CONF)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\alex8\AppData\Local\Programs\Python\Python311\Lib\site-packages\spyder\api\plugins\new_api.py", line 331, in __init__
    container.setup()
  File "C:\Users\alex8\AppData\Local\Programs\Python\Python311\Lib\site-packages\spyder\plugins\pythonpath\container.py", line 55, in setup
    self._load_pythonpath()
  File "C:\Users\alex8\AppData\Local\Programs\Python\Python311\Lib\site-packages\spyder\plugins\pythonpath\container.py", line 136, in _load_pythonpath
    system_path = get_system_pythonpath()
                  ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\alex8\AppData\Local\Programs\Python\Python311\Lib\site-packages\spyder\plugins\pythonpath\utils.py", line 31, in get_system_pythonpath
    env = get_user_env()
          ^^^^^^^^^^^^^^
  File "C:\Users\alex8\AppData\Local\Programs\Python\Python311\Lib\site-packages\spyder\utils\environ.py", line 71, in get_user_env
    env_dict = get_user_environment_variables()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\alex8\AppData\Local\Programs\Python\Python311\Lib\site-packages\spyder\utils\environ.py", line 60, in get_user_environment_variables
    res = stdout.decode().strip().split(os.linesep)
          ^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x85 in position 76: invalid start byte

Versions

  • Spyder version: 5.4.1 (pip) [reproducible also with standalone Spyder]
  • Python version: 3.11.1 64-bit [reproducible also in 3.10]
  • Qt version: 5.15.2
  • PyQt version: 5.15.7
  • Operating System name/version: Windows 10 Home, 22H2, build 19045.2364

Dependencies

# Mandatory:
atomicwrites >=1.2.0          :  1.4.1 (OK)
chardet >=2.0.0               :  5.1.0 (OK)
cloudpickle >=0.5.0           :  2.2.0 (OK)
cookiecutter >=1.6.0          :  2.1.1 (OK)
diff_match_patch >=20181111   :  20200713 (OK)
intervaltree >=3.0.2          :  3.1.0 (OK)
IPython >=7.31.1;<9.0.0       :  8.7.0 (OK)
jedi >=0.17.2;<0.19.0         :  0.18.2 (OK)
jellyfish >=0.7               :  0.9.0 (OK)
jsonschema >=3.2.0            :  4.17.3 (OK)
keyring >=17.0.0              :  23.13.1 (OK)
nbconvert >=4.0               :  7.2.7 (OK)
numpydoc >=0.6.0              :  1.5.0 (OK)
paramiko >=2.4.0              :  2.12.0 (OK)
parso >=0.7.0;<0.9.0          :  0.8.3 (OK)
pexpect >=4.4.0               :  4.8.0 (OK)
pickleshare >=0.4             :  0.7.5 (OK)
psutil >=5.3                  :  5.9.4 (OK)
pygments >=2.0                :  2.14.0 (OK)
pylint >=2.5.0;<3.0           :  2.15.9 (OK)
pylint_venv >=2.1.1           :  2.3.0 (OK)
pyls_spyder >=0.4.0           :  0.4.0 (OK)
pylsp >=1.7.0;<1.8.0          :  1.7.0 (OK)
pylsp_black >=1.2.0           :  1.2.1 (OK)
qdarkstyle >=3.0.2;<3.1.0     :  3.0.3 (OK)
qstylizer >=0.2.2             :  0.2.2 (OK)
qtawesome >=1.2.1             :  1.2.2 (OK)
qtconsole >=5.4.0;<5.5.0      :  5.4.0 (OK)
qtpy >=2.1.0                  :  2.3.0 (OK)
rtree >=0.9.7                 :  1.0.1 (OK)
setuptools >=49.6.0           :  65.5.0 (OK)
sphinx >=0.6.6                :  6.0.0 (OK)
spyder_kernels >=2.4.1;<2.5.0 :  2.4.1 (OK)
textdistance >=4.2.0          :  4.5.0 (OK)
three_merge >=0.1.1           :  0.1.1 (OK)
watchdog >=0.10.3             :  2.2.1 (OK)
zmq >=22.1.0                  :  24.0.1 (OK)

# Optional:
cython >=0.21                 :  None (NOK)
matplotlib >=3.0.0            :  3.6.2 (OK)
numpy >=1.7                   :  1.24.1 (OK)
pandas >=1.1.1                :  None (NOK)
scipy >=0.17.0                :  1.9.3 (OK)
sympy >=0.7.3                 :  1.11.1 (OK)

@ccordoba12
Copy link
Member

Hey @alessandro-soldati, thanks for reporting. This is a duplicate of #20309 and it'll be fixed in our next version (5.4.2), to be released by the end of the week.

In the meantime, please use 5.4.0.

@alessandro-soldati
Copy link
Author

Hi Carlos, Thanks - I think I used the wrong query in the issue report - sorry for duplicating!
Looking forward to 5.4.2!

@ccordoba12
Copy link
Member

No worries, that's fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants