invoking PsychoPyIDE's own python from outside PsychoPyIDE ?

21 views
Skip to first unread message

Alex Holcombe

unread,
May 27, 2009, 3:19:59 AM5/27/09
to psychop...@googlegroups.com
The PsychoPyIDE editor is missing some advanced text editing features,
as well as shortcut key bindings and isn't customizable. However I
need to use that stand-alone PsychoPyIDE psychopy installation to make
things easier for the newbies in my lab. When I'm editing and testing
their code on their machine, though, I'd like to invoke python from
the terminal, that way I can use IPython and an advanced text editor.
With IPython I get the great debugging functionality of being able to
access the variables my program created after it terminates.

Is there a way to invoke python from terminal and have it use the same
psychopy installation as PsychoPyIDE? I tried invoking its
installation of python:
"/Applications/PsychoPyIDE.app/Contents/MacOS/python"
Then I added the "/Applications/PsychoPyIDE.app/Contents/Resources/lib/
python2.5" directory to my sys.path so python could find the local
installed libraries.
However when I then try
from psychopy import *
I get the following error

from psychopy import * Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Applications/PsychoPyIDE.app/Contents/Resources/lib/python2.5/
psychopy/misc.py", line 7, in <module>
import monitors
File "/Users/jwp/Code/psychopy/monitors/__init__.py", line 2, in
<module>
File "/Users/jwp/Code/psychopy/monitors/calibTools.py", line 13, in
<module>
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/scipy-0.7.0.dev4645-py2.5-macosx-10.3-i386.egg/scipy/
__init__.py", line 86, in <module>
ImportError: cannot import name Tester

I'm not sure I'm even taking the right approach here, but PsychoPyIDE
must invoke python somehow, which I suppose is the way I'd like to
invoke it.

Alex

Alex Holcombe
www.psych.usyd.edu.au/staff/alexh/


Jon Peirce

unread,
May 27, 2009, 4:57:25 AM5/27/09
to psychop...@googlegroups.com
I think you are taking the right approach, but I'm afraid I don't have an answer. The app bundle is created using py2app and it does various magic that i don't understand. e.g. i also don't understand why it seems to code the path as if the files were still on my desktop but still manages to run them.

I suspect it's something to do with the app bundle doing fancy things to it's path on startup. Have a look at the __boot__.py file in ..../Contents/Resources and especially at the _site_packages() and _run() methods. Maybe they give some clues.

In the longer term i want simply to improve the IDE (soon to be called Coder) so that it does have the functionality you want, including adding a debugger, that will pause on command or on an error.

Obviously, do let us know if you make any progress
chrs,
Jon

This message has been checked for viruses but the contents of an attachment may still contain software viruses, which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.

Jason Gors

unread,
May 27, 2009, 11:37:47 AM5/27/09
to psychop...@googlegroups.com
This is actually something that I've been trying to figure out as
well. It would be great to be able to invoke PsycoPy from the
terminal (I'm on a Mac) the way that PyEPL can be invoked/imported,
thus getting the benefits of IPython, etc. However, I've gotten kind
of busy lately and haven't kept up on trying to figure this out, but
this would be a great addition -- please keep this post up to date w/
any advances/suggestions (and I'll certainly do the same).

Best All,

Jason
Reply all
Reply to author
Forward
0 new messages