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

The PYTHONPATH manager on the Mac app does not work with the EPD64 interpreter #1321

Closed
spyder-bot opened this issue Feb 17, 2015 · 10 comments
Closed

Comments

@spyder-bot
Copy link
Collaborator

From breed...@gmail.com on 2013-03-17T10:32:33Z

Spyder Version: 2.2.0beta4
Python Version: 2.7.3
Qt Version: 4.8.2, PyQt4 (API v2) 4.9.4 on Darwin

What steps will reproduce the problem?

  1. Install Spyder from the disk image (not macports)
    1. Go to Preferences>Console>Advanced Settings and then reassign the "Path to Python Interpreter Executable Binary" to /Library/Frameworks/EPD64.framework/Versions/7.3/bin/python.
    2. Restart Spyder
    3. type "print sys.path" at the console What is the expected output? What do you see instead? When I do "print sys.path" with the default python interpreter, the directories listed in the PYTHONPATH manager show up. When I do "print sys.path" with the EPD64 interpreter, the directories listed in the PYTHONPATH manager do not show up.

Please provide any additional information below

.

Original issue: http://code.google.com/p/spyderlib/issues/detail?id=1321

@spyder-bot
Copy link
Collaborator Author

From ccordoba12 on 2013-06-29T14:18:39Z

Please update your Spyder version, it should work now.

Status: WontFix

@spyder-bot
Copy link
Collaborator Author

From breed...@gmail.com on 2013-06-29T15:43:36Z

I just tried it out on 2.2.0 (just downloaded it), and got the same result. "print sys.path" does not list the directories in the PYTHONPATH manager when I am using the EPD64 interpreter.

@spyder-bot
Copy link
Collaborator Author

From ccordoba12 on 2013-06-29T15:50:14Z

Right, I forgot that this one was about our PYTHONPATH manager. Sorry for the inconvenience.

Status: Accepted
Labels: MS-v2.3

@spyder-bot
Copy link
Collaborator Author

From breed...@gmail.com on 2013-10-21T13:34:07Z

Issue still exists in Spyder 2.2.5.

@spyder-bot
Copy link
Collaborator Author

From ccordoba12 on 2013-10-21T14:13:30Z

Yes, this is really tricky to solve. Currently we are hijacking PYTHONPATH to let our consoles find our own sitecustomize, which has the essential glue to make code completion and debugging work.

But we also are removing PYTHONPATH completely in that sitecustomize (for external interpreters only) so that people can't import the app libraries through it.

I think what I really need is a good library to manipulate env vars, so that I can easily add and remove paths from PYTHONPATH.

@spyder-bot
Copy link
Collaborator Author

From breed...@gmail.com on 2013-10-21T18:45:31Z

Yeah, I was trying to figure out a work around today. When I run python from the command line I can just add directories to your $PYTHONPATH environment variable. If I install Spyder using the DMG, I am forced to add the directories at the start of every script. On the other hand, if I install Spyder using setup.py (or Macports) inside my Canopy installation and execute Spyder from the command line, then it inherits the $PYTHONPATH variable and PYTHONPATH manager works properly. (I imagine you are aware of this, Carlos. I am just putting this comment here for others.)

@spyder-bot
Copy link
Collaborator Author

From ccordoba12 on 2013-10-21T20:49:46Z

Yes, now that I remember another hairy issue is that py2app adds a couple of things to PYTHONPATH that really mess up external interpreters.

So what needs to be done is preserve the user's PYTHONPATH and remove all the rest! That's why it's tricky.

@spyder-bot
Copy link
Collaborator Author

From mrcl...@gmail.com on 2013-11-28T13:24:16Z

I've implemented a workaround that modifies sys.path in my interpreter's startup script. This was an extension of my solution to another issue regarding shell environment variable inheritance [1]. It will take the user's PYTHONPATH as specified in either /etc/profile or ~/.profile and and insert it into the sys.path. If you don't need system environment variables transferred to Spyder's os.environ, just delete/comment out that portion of the script. My script is as follows:

import os
import sys
import subprocess

envstr = subprocess.check_output('source /etc/profile; source ~/.profile; printenv', shell=True)
env = dict([a.split('=') for a in envstr.strip().split('\n')])
os.environ.update(env)

if env.has_key('PYTHONPATH'):
pythonpath = env['PYTHONPATH'].split(':')
pythonpath.reverse()
for path in pythonpath:
sys.path.insert(2, path)

[1] https://groups.google.com/forum/#!msg/spyderlib/lCXOYk-FSWI/SDm-O8HHNMsJ

@spyder-bot
Copy link
Collaborator Author

From ccordoba12 on 2013-12-11T12:41:34Z

Labels: -MS-v2.3 MS-v2.3.1

@spyder-bot
Copy link
Collaborator Author

From ccordoba12 on 2014-08-17T18:43:17Z

Labels: -MS-v2.3.1 MS-v2.4

@ccordoba12 ccordoba12 modified the milestones: v2.3.4, v2.4 Mar 6, 2015
@ccordoba12 ccordoba12 changed the title The PYTHONPATH manager does not work with the EPD64 interpreter. The PYTHONPATH manager on the Mac app does not work with the EPD64 interpreter Mar 6, 2015
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

2 participants