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

'Execute in external system terminal' unwantedly uses python2 on ubuntu16.04 #5165

Closed
cknoll opened this issue Sep 7, 2017 · 4 comments
Closed
Labels
Milestone

Comments

@cknoll
Copy link
Contributor

cknoll commented Sep 7, 2017

Description of your problem

What steps will reproduce the problem?

The simple script

import sys
print(sys.version)

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

It produces different results, depending on run-configuration
option 1 "Execute in current console" and 2 "... dedicated console" results in output 3.5.2
case 3 "Excecute in external system terminal" results in output 2.17.12

Please provide any additional information below

I think the problem might be related to this line
https://github.com/spyder-ide/spyder/blob/master/spyder/utils/programs.py#L268

p_args = ['python']

My suggestion instead:

if PY2:
    p_args = ['python2']
 else:
    p_args = ['python3']

Note that python runs python2 by default on Ubuntu16.04 and Debian9 (and I suppose at least the earlier versions)

Versions and main components

  • Spyder Version: 3.2.2
  • Python Version: 3.5.2
  • Qt Version: 4.8.7
  • PyQt Version: 4.11.4
  • Operating system: Ubuntu 16.04.

Dependencies

IPython >=4.0 : 6.1.0 (OK)
cython >=0.21 : None (NOK)
jedi >=0.9.0 : 0.10.2 (OK)
nbconvert >=4.0 : 5.3.1 (OK)
numpy >=1.7 : 1.11.0 (OK)
pandas >=0.13.1 : 0.17.1 (OK)
psutil >=0.3 : 5.3.0 (OK)
pycodestyle >=2.3: 2.3.1 (OK)
pyflakes >=0.6.0 : 1.6.0 (OK)
pygments >=2.0 : 2.2.0 (OK)
pylint >=0.25 : 1.7.2 (OK)
qtconsole >=4.2.0: 4.3.1 (OK)
rope >=0.9.4 : 0.10.7 (OK)
sphinx >=0.6.6 : 1.6.3 (OK)
sympy >=0.7.3 : 0.7.6.1 (OK)

@ccordoba12 ccordoba12 added this to the v3.2.x milestone Sep 8, 2017
@ccordoba12
Copy link
Member

My suggestion instead:

if PY2:
    p_args = ['python2']
else:
    p_args = ['python3']

Your suggestion is the right one, but it should be applied only to Linux.

If you want to see this in our next release, please open a pull request with your suggestion against the 3.x branch. Else, it's going to take us some time to fix this because it's low priority.

@jitseniesen
Copy link
Member

Alternatively, we could use get_python_executable() from https://github.com/spyder-ide/spyder/blob/master/spyder/utils/misc.py#L173 , which (I think) uses the same executable that Spyder is run with.

@ccordoba12
Copy link
Member

Yep, that's a better suggestion. Thanks @jitseniesen!

@cknoll
Copy link
Contributor Author

cknoll commented Sep 9, 2017

I opened a PR (#5181). I would like to see this merged asap, because I will use spyder in a Python-for-engineering-lecture and running scripts in external terminals is necessary for some of the content.
(But of course: The project has its own priorities... )

@ccordoba12 ccordoba12 modified the milestones: v3.2.3, v3.2.x Sep 9, 2017
ccordoba12 added a commit that referenced this issue Sep 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants