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

Automatically executing code at console startup seems broken #126

Open
Khris777 opened this issue Jul 17, 2019 · 4 comments · May be fixed by #127
Open

Automatically executing code at console startup seems broken #126

Khris777 opened this issue Jul 17, 2019 · 4 comments · May be fixed by #127
Assignees
Labels
type:Bug Something isn't working

Comments

@Khris777
Copy link

Problem Description

In the settings under the IPython tag there is the section "Start" where you can enter code that should be executed automatically when starting a new console.

Apparently the code added there is not properly executed when starting a new console, it seems like only parts of it are executed with a bit of randomness involved:

What steps reproduce the problem?

Add different imports to the Ipython start field in the settings, then start new console. These are my results:

  • import sys, import os -> os imported, sys not imported.

  • import sys, import os, import shutil ->os and shutil imported, sys not imported

  • import os, import shutil, import sys -> Only os imported, sys and shutil not imported.

  • import random, import numpy, import sys, import os, import shutil -> everything but sys imported

  • import pandas as pd,pd.set_option('display.max_columns',25) -> pandas imported, setting not set (still at default value 0).

Generally it seems that mostly sys is not imported if it's there while other modules rarely have an issue.

My main issue is with pandas being imported but the following set_option()-call not being executed.

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

Everything in the autostart field should be imported and executed.

Versions

  • Spyder version: 3.3.6
  • Python version: 3.7.3 64-bit
  • Qt version: 5.9.6
  • PyQt version: 5.9.2
  • Operating System name/version: Windows 10

Dependencies

IPython >=4.0     :  7.6.1 (OK)
cython >=0.21     :  0.29.12 (OK)
jedi >=0.9.0      :  0.13.3 (OK)
matplotlib >=2.0.0:  3.1.0 (OK)
nbconvert >=4.0   :  5.5.0 (OK)
numpy >=1.7       :  1.16.4 (OK)
pandas >=0.13.1   :  0.24.2 (OK)
pycodestyle >=2.3 :  2.5.0 (OK)
pyflakes >=0.6.0  :  2.1.1 (OK)
pygments >=2.0    :  2.4.2 (OK)
pylint >=0.25     :  2.3.1 (OK)
qtconsole >=4.2.0 :  4.5.1 (OK)
rope >=0.9.4      :  0.14.0 (OK)
sphinx >=0.6.6    :  2.1.2 (OK)
sympy >=0.7.3     :  1.4 (OK)
@ccordoba12
Copy link
Member

@steff456, please take a look at this one.

@steff456
Copy link
Member

I could reproduce this issue, but the problem is coming from spyder-kernels instead of spyder. I'm transfering this issue there.

@steff456 steff456 transferred this issue from spyder-ide/spyder Jul 17, 2019
@steff456 steff456 added the type:Bug Something isn't working label Jul 17, 2019
@steff456 steff456 added this to the future milestone Jul 17, 2019
@steff456
Copy link
Member

@Khris777 I found the error, but please remember that in order to enter code that should be executed automatically when starting a new console it needs to be separated by ; not ,

@Khris777
Copy link
Author

Khris777 commented Jul 18, 2019

@steff456 Thank you for the advice.

I am using the german localization of Spyder and the explanation in the options tells me I have to use commas.

EDIT: When adding
import pandas as pd; pd.set_option('display.max_columns',25); pd.set_option('display.unicode.east_asian_width',True); pd.set_option('display.max_colwidth',30); pd.set_option('precision',5)

to autostart using semicolons, it does not work, pandas is not imported.

@goanpeca goanpeca removed this from the future milestone Feb 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants