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

Sitecustomize fails when current directory has non-ascii chars #3407

Closed
Dschoni opened this issue Sep 6, 2016 · 13 comments
Closed

Sitecustomize fails when current directory has non-ascii chars #3407

Dschoni opened this issue Sep 6, 2016 · 13 comments

Comments

@Dschoni
Copy link

Dschoni commented Sep 6, 2016

Description

What steps will reproduce the problem?

  1. Start Spyder.
  2. Open any *.py file.
  3. Close Spyder.
  4. Open again.

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

The internal python console shows the message "'import sitecustomize' failed"
and stops loading any further. No commands can be executed. After running
spyder --reset
it loads normally until the next startup after I had a file opened.

Please provide any additional information below

Version and main components

  • Spyder Version: 2.3.8
  • Python Version: 2.7.12
  • Qt Versions: 4.8.7, PyQt4 (API v2) 4.11.4 on Linux

Optional dependencies

pyflakes >=0.5.0   :  1.1.0 (OK)
pep8 >=0.6         :  None (NOK)
pygments >=1.6     :  2.1 (OK)
IPython >=1.0      :  2.4.1 (OK)
zmq >=2.1.11       :  15.2.0 (OK)
pandas >=0.13.1    :  0.17.1 (OK)
sphinx >=0.6.6     :  1.3.6 (OK)
psutil >=0.3       :  3.4.2 (OK)
rope >=0.9.2       :  0.10.2 (OK)
jedi >=0.8.1;<0.9.0:  0.9.0 (NOK)
matplotlib >=1.0   :  1.5.1 (OK)
sympy >=0.7.3      :  None (NOK)
pylint >=0.25      :  1.5.2 (OK)

@Dschoni
Copy link
Author

Dschoni commented Sep 6, 2016

I found, this only happens, when the working directory at the time of closing spyder has special characters (e.g. 'ß') somewhere in the path.

@ccordoba12 ccordoba12 changed the title Import sitecustomize failed. Sitecustomize fails when current directory has non-ascii chars Sep 6, 2016
@ccordoba12 ccordoba12 added this to the v3.1 milestone Sep 6, 2016
@ccordoba12
Copy link
Member

Thanks for reporting. We'll fix this error after we release Spyder 3.0 :-)

@malliwi88
Copy link
Contributor

Hi @Dschoni

I test your problem on my Linux Deepin machine (15.03 64 bits)

  1. Open spyder and open *.py file
    test 3407 before seleccion_009
  2. reopen Spyder
    test 3407 after seleccion_009

Spyder & Python Enviroment

Spyder 3.0.1
Python 2.7.12 :: Continuum Analytics, Inc.(Anaconda 4.2 64 bits)
Linux wallas-pc 4.4.0-2-deepin-amd64 #1 SMP Deepin 4.4.6-4 (2016-07-01) x86_64 GNU/Linux

Dependences

jedi >=0.8.1 : 0.9.0 (OK)
matplotlib >=1.0 : 1.5.3 (OK)
nbconvert >=4.0 : 4.2.0 (OK)
numpy >=1.7 : 1.11.2 (OK)
pandas >=0.13.1 : 0.19.0 (OK)
pep8 >=0.6 : 1.7.0 (OK)
psutil >=0.3 : 4.3.1 (OK)
pyflakes >=0.5.0 : 1.3.0 (OK)
pygments >=2.0 : 2.1.3 (OK)
pylint >=0.25 : 1.5.4 (OK)
qtconsole >=4.2.0: 4.2.1 (OK)
rope >=0.9.4 : 0.9.4 (OK)
sphinx >=0.6.6 : 1.4.8 (OK)
sympy >=0.7.3 : 1.0 (OK)

As you can see, you could work with spyder 3.0.1 and our future release (v3.1). Because It solves your issue. @ccordoba12 @goanpeca

Thanks for the report and contribute with us, to make better Spyder;).

@Dschoni
Copy link
Author

Dschoni commented Oct 25, 2016

Well no.
The problem is still existing.

Create a folder with non-asci chars (e.g. 'äöüß').
Start spyder.
Set active working directory to that folder.
Close spyder.
Start spyder.
--> Import sitecustomize failed.
(Tested with spyder 3.0.1)

Am 2016-10-22 21:52, schrieb malliwi88:

Hi @Dschoni [2]

I test your problem on my Linux Deepin machine (15.03 64 bits)

Open spyder and open *.py file
[3]
*

reopen Spyder
[4]

SPYDER & PYTHON ENVIROMENT

Spyder 3.0.1
Python 2.7.12 :: Continuum Analytics, Inc.(Anaconda 4.2 64 bits)
Linux wallas-pc 4.4.0-2-deepin-amd64 #1 [1] SMP Deepin 4.4.6-4
(2016-07-01) x86_64 GNU/Linux

DEPENDENCES

jedi >=0.8.1 : 0.9.0 (OK)
matplotlib >=1.0 : 1.5.3 (OK)
nbconvert >=4.0 : 4.2.0 (OK)
numpy >=1.7 : 1.11.2 (OK)
pandas >=0.13.1 : 0.19.0 (OK)
pep8 >=0.6 : 1.7.0 (OK)
psutil >=0.3 : 4.3.1 (OK)
pyflakes >=0.5.0 : 1.3.0 (OK)
pygments >=2.0 : 2.1.3 (OK)
pylint >=0.25 : 1.5.4 (OK)
qtconsole >=4.2.0: 4.2.1 (OK)
rope >=0.9.4 : 0.9.4 (OK)
sphinx >=0.6.6 : 1.4.8 (OK)
sympy >=0.7.3 : 1.0 (OK)

As you can see, you could work with spyder 3.0.1 and our future
release (v3.1). Because It solves your issue. @ccordoba12 [5]
@goanpeca [6]

Thanks for the report and contribute with us, to make better Spyder;).

You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub [7], or mute the
thread [8].

Links:

[1] #1
[2] https://github.com/Dschoni
[3]
https://cloud.githubusercontent.com/assets/5307894/19622079/13b5a98c-9867-11e6-8ca5-a6c3a08ca0b2.png
[4]
https://cloud.githubusercontent.com/assets/5307894/19622080/210b3796-9867-11e6-8fed-7c525b7a7b8f.png
[5] https://github.com/ccordoba12
[6] https://github.com/goanpeca
[7]
#3407 (comment)
[8]
https://github.com/notifications/unsubscribe-auth/AH3bazIqqUuRsHY6joMGk-xuYIU-7mM7ks5q2mmYgaJpZM4J10sI

@ccordoba12
Copy link
Member

@dalthviz, please work on this one. For this you need to create a conda environment with a non-ascii name, install Spyder on it and start it.

@dalthviz
Copy link
Member

dalthviz commented Dec 4, 2016

Hi @Dschoni, sorry for the late response, can you try to test the problem with Spyder 3.0.2?. Also, how are you setting up the active working directory, something like this?:

image

All the information that you can give us would be greatly appreciated in order to recreate the error that you are having. :)

@Dschoni
Copy link
Author

Dschoni commented Dec 6, 2016 via email

@Dschoni
Copy link
Author

Dschoni commented Dec 6, 2016

Sorry, no. It's back again. I tried with different bundled versions in Anaconda. With a plain Spyder install.
The error message in terminal is still the same:

'import sitecustomize' failed; use -v for traceback

@dalthviz
Copy link
Member

dalthviz commented Dec 8, 2016

Hi again @Dschoni, it's really strange that it worked for you (at least to close and open Spyder), and then it stopped working. Searching a little bit I think that maybe your problem is about the configuration of your firewall like in this post. From there are some steps that you can follow:

  1. Disable the firewall.
  2. Reset Spyder and apply default settings.
  3. Run Spyder again.
  4. Enable the firewall.

Can you see if following these steps make Spyder work again? I will open a new issue for the new error that you post when you ran Spyder 3.0.2. Also if you can use the -v option to print the traceback and paste it here would be great.

@Dschoni
Copy link
Author

Dschoni commented Dec 9, 2016 via email

@ccordoba12
Copy link
Member

@Dschoni, to allow printing the sitecustomize traceback, please start Spyder like this in a terminal

SPYDER_DEBUG=3 spyder

@ccordoba12
Copy link
Member

Then the failure should be printed in our Python and IPython consoles.

@Dschoni
Copy link
Author

Dschoni commented Dec 13, 2016

So, finally back at work, here is the more exact error description:

I open Spyder, I change to a working directory (via GUI) that has special characters (in my case, the german version of 'Desktop', which is 'Arbeitsfläche'). As soon, as I do that, the debug shell throws the following exception:

Traceback (most recent call last):
File "/home/user/.local/lib/python2.7/site-packages/spyder/plugins/ipythonconsole.py", line 845, in set_current_client_working_directory
shellwidget.set_cwd(directory)
File "/home/user/.local/lib/python2.7/site-packages/spyder/widgets/ipythonconsole/shell.py", line 87, in set_cwd
"get_ipython().kernel.set_cwd(r'{}')".format(dirname))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 23: ordinal not in range(128)

When I close Spyder in this state and restart it (without resetting), the debug shell shows:

Traceback (most recent call last):
File "/home/user/anaconda2/lib/python2.7/site.py", line 498, in execsitecustomize
import sitecustomize
File "/home/user/.local/lib/python2.7/site-packages/spyder/utils/site/sitecustomize.py", line 241, in
import matplotlib
File "/home/user/anaconda2/lib/python2.7/site-packages/matplotlib/init.py", line 1138, in
rcParams = rc_params()
File "/home/user/anaconda2/lib/python2.7/site-packages/matplotlib/init.py", line 971, in rc_params
fname = matplotlib_fname()
File "/home/user/anaconda2/lib/python2.7/site-packages/matplotlib/init.py", line 786, in matplotlib_fname
cwd = os.getcwdu()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 23: ordinal not in range(128)

leading to a failing import of sitecustomize and therefore unstable internal console. Resetting solves the problem (as I guess, it resets the current working directory to a default, without special characters).

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

No branches or pull requests

5 participants