question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Startup run code of IPython is not working when using projects

See original GitHub issue

Description

What steps will reproduce the problem?

Hello.

This promblem is similar to #16748. This issue is also occurring in 5.x branch.

Thank you.

Versions

  • Spyder version: 5.4.0.dev0 30e09f8ee
  • Python version: 3.9.12
  • Qt version: 5.12.9
  • PyQt5 version: 5.12.3
  • Operating System: Linux 5.4.0-110-generic

Dependencies

# Mandatory:
atomicwrites >=1.2.0                  :  1.4.0 (OK)
chardet >=2.0.0                       :  4.0.0 (OK)
cloudpickle >=0.5.0                   :  2.0.0 (OK)
cookiecutter >=1.6.0                  :  1.7.3 (OK)
diff_match_patch >=20181111           :  20200713 (OK)
intervaltree >=3.0.2                  :  3.1.0 (OK)
IPython >=7.31.1;<8.0.0               :  7.33.0 (OK)
jedi >=0.17.2;<0.19.0                 :  0.18.1 (OK)
jellyfish >=0.7                       :  0.8.2 (OK)
jsonschema >=3.2.0                    :  4.4.0 (OK)
keyring >=17.0.0                      :  23.4.0 (OK)
nbconvert >=4.0                       :  6.4.4 (OK)
numpydoc >=0.6.0                      :  1.2 (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.8.0 (OK)
pygments >=2.0                        :  2.11.2 (OK)
pylint >=2.5.0                        :  2.9.6 (OK)
pyls_spyder >=0.4.0                   :  0.4.0 (OK)
pylsp >=1.4.1;<1.5.0                  :  1.4.1 (OK)
pylsp_black >=1.2.0                   :  1.2.1 (OK)
qdarkstyle >=3.0.2;<3.1.0             :  3.0.3 (OK)
qstylizer >=0.1.10                    :  0.1.10 (OK)
qtawesome >=1.0.2                     :  1.0.3 (OK)
qtconsole >=5.3.0;<5.4.0              :  5.4.0.dev0 (OK)
qtpy >=2.1.0                          :  2.1.0 (OK)
rtree >=0.9.7                         :  0.9.7 (OK)
setuptools >=49.6.0                   :  59.5.0 (OK)
sphinx >=0.6.6                        :  4.4.0 (OK)
spyder_kernels >=2.3.0;<2.4.0         :  2.4.0.dev0 (OK)
textdistance >=4.2.0                  :  4.2.1 (OK)
three_merge >=0.1.1                   :  0.1.1 (OK)
watchdog >=0.10.3                     :  2.1.6 (OK)
xdg >=0.26                            :  0.27 (OK)
zmq >=17                              :  22.3.0 (OK)

# Optional:
cython >=0.21                         :  0.29.28 (OK)
matplotlib >=3.0.0                    :  3.5.1 (OK)
numpy >=1.7                           :  1.21.5 (OK)
pandas >=1.1.1                        :  1.4.2 (OK)
scipy >=0.17.0                        :  1.7.3 (OK)
sympy >=0.7.3                         :  1.10.1 (OK)

# Spyder plugins:
spyder_okvim.spyder.plugin 0.0.1.dev0 :  0.0.1-dev0 (OK)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
dalthvizcommented, May 23, 2022

Thanks for the step by step description @ok97465 ! I was able to reproduce this 👍 Seems like the console when opening a project is not getting the correct working directory set (I’m getting for the first console open with the project my home directory instead):

imagen

Checking the working directory options I’m seeing this:

imagen

1reaction
ok97465commented, May 21, 2022

Oh I see, I was thinking that you could do a PR replaicing what is currently in the repo with your version (just changing the entrypoint and other related names to use spyder-vim/SpyderVim/spyder_vim) and maybe help us maintaing the plugin from that repo but if that not feasible, could be okay if we mention your repo in the issues from the spyder-vim repo so users that could be interested in using the plugin with Spyder 5 could check your repo out?

My vim has a completely different structure from the spyder vim, so I have to create and upload all the new files. If I do that, my vim has an intermittent error and the bug is often reported on Spyder-ide, which will annoy you. I think it would be better to make the spyder-vim compatible with the spyder 5, and I will try it within next month.

Does your custom script to run at start has relative imports? Maybe the console is not getting set the project path before running the start script and then is being unable to run it? Will try to check a little bit more to replicate it

The initial files(import_in_console.py) within the project are as follows:

from numpy import pi

Preference > IPython Console > Startup > Run code is below:

from import_in_console import *

Peek 2022-05-22 07-13

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to create a project specific startup script for ipython
The best way to do this would be to create a .ipython directory in your project directory. You can do this as: $...
Read more >
What to do when things go wrong - The Jupyter Notebook
If you're using a menu shortcut or Anaconda launcher to start it, try opening a terminal or command prompt and running the command...
Read more >
Is iPython still virtualenv unaware? - Google Groups
Searching the web for the issue, I found a few posts suggesting that iPython was "unaware" of virtual environments, Calling IPython from a...
Read more >
IntelliJ IDEA - Jupyter notebook support - JetBrains
To start working with Jupyter notebooks in IntelliJ IDEA: Create a new project, ... Execute any of the code cells to launch the...
Read more >
Introducing IPython — IPython 3.2.1 documentation
Startup Files¶ ... If you want some code to be run at the beginning of every IPython session, the easiest way is to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found