Version Prefix and $PYTHONPATH

A extensible, generic scripting IDE
Post Reply
drw
Posts: 4
Joined: Sun Nov 05, 2006 8:17 pm

Version Prefix and $PYTHONPATH

Post by drw » Sun Nov 05, 2006 8:29 pm

Hi!
Nice...... :D

I'm currently running 3 versions of python on an Intel Mac
2.3.5, 2.4.x, 2.5.x
Would someone explain to me if it's poss. and if then how,
to include another version in the (Version Prefix) menu
it's picking up /usr/bin
/usr/local/bin
and I also need access to /Library/Frameworks/Python.framework/Versions/blah******

also, how does one make ScrIDE sensitive to
$PYTHONPATH and
$PYTHONSTARTUP

many thanks,

David

gandreas
Immortal
Posts: 1464
Joined: Wed Feb 04, 2004 6:02 pm
Contact:

Post by gandreas » Mon Nov 06, 2006 9:45 am

Make a file called "MyPythonVersion.scrIDErc" containing the following

Code: Select all

{
	ScrIDELanguageName = Python;
	ScrIDEKind = VersionPrefix;
	path = "/Library/Frameworks/Python.framework/Version/blah";
	name = "My Version";
}
Double click on this to launch ScrIDE, it will ask if you want to install it (and you do), and it will be added.

This an more details are covered in the "User Extensions"

Could you explain what you mean by making it "sensitive to" environment variables?

drw
Posts: 4
Joined: Sun Nov 05, 2006 8:17 pm

Post by drw » Tue Nov 07, 2006 10:49 pm

Thanks for your reply. I'll come back to the $PYTHONPATH query later.
I see your instructions are as per p14 of the ScrIDEdoc.pdf
When I do as you/it suggests I get an "operation couldn't be completed" error (-10660)
When I open the file by dragging it over the file icon (actually a dock alias) it asked me if I want to install and then, when OKed, it gives me the following message in the Console window:

Code: Select all

Extension file empty (error in plist?): /Users/drw/Library/Application Support/ScrIDE/MyPythonVersion.scrIDErc
The file "/Users/drw/Library/Application Support/ScrIDE/MyPythonVersion.scrIDErc" is created and contains

Code: Select all

{
? ?ScrIDELanguageName = Python;
? ?ScrIDEKind = VersionPrefix;
? ?path = "/Library/Frameworks/Python.framework/Versions/MacPython2.4/" ;
? ?name = "MyCurrentVersion";
}
You'll notice from the above that scrIDE was installed in /Applications.
When I moved it to ~/Applications the same error occurs.
any clues as to what's going on?

thanks a million,
David

gandreas
Immortal
Posts: 1464
Joined: Wed Feb 04, 2004 6:02 pm
Contact:

Post by gandreas » Wed Nov 08, 2006 9:51 am

If, in a terminal window, you change to the /Users/drw/Library/Application Support/ScrIDE/ directory and then do:

Code: Select all

plutil MyPythonVersion.scrIDErc
does it complain about anything?

drw
Posts: 4
Joined: Sun Nov 05, 2006 8:17 pm

Post by drw » Wed Nov 08, 2006 10:53 pm

Code: Select all

203-173-0-181:~/Library/Application Support/ScrIDE drw$ plutil MyPythonVersion.scrIDErc
2006-11-09 14:46:41.928 plutil[7971] CFLog (0): 
        CFPropertyListCreateFromXMLData(): plist parse failed; the data is not proper UTF-8. The file name for this data could be:
        MyPythonVersion.scrIDErc
        The parser will retry as in 10.2, but the problem should be corrected in the plist.
MyPythonVersion.scrIDErc:
XML parser error:
        Unexpected character { at line 1
Old-style plist parser error:
        Expected terminating '}' for dictionary at line 2
An encoding error? If I "more" the file i get

Code: Select all

{
<CA> <CA>ScrIDELanguageName = Python;
<CA> <CA>ScrIDEKind = VersionPrefix;
<CA> <CA>path = "/Library/Frameworks/Python.framework/Versions/MacPython2.4/" ;
<CA> <CA>name = "MyCurrentVersion";
}

gandreas
Immortal
Posts: 1464
Joined: Wed Feb 04, 2004 6:02 pm
Contact:

Post by gandreas » Thu Nov 09, 2006 12:06 am

It appears then to be a copy & paste problem - there lines should be indented with tabs (or spaces, or nothing at all), but it looks like something funky (maybe non-breaking spaces) got in there instead.

Easiest is to just trim out all that leading white space, and then plutil should be happy (and then ScrIDE will be happy as well).

drw
Posts: 4
Joined: Sun Nov 05, 2006 8:17 pm

Post by drw » Thu Nov 09, 2006 1:43 am

leading white space was not the only problem; still, once I retyped it in vi, all was OK. merci merci
...
On Launch, no matter what version/location I use, I get the following, or similar, error?warning:

17:17:39 unable to put task 8319(/Library/Frameworks/Python.framework/Versions/Current/bin/python) into same group as self
looks like a permissions problem... is it potentially serious?
...
Now, about $PYTHONPATH (the python shell variable):
How do I make ScrIDE look in at it for paths for *.py files?
(or an I missing something really basic.. (I'm used to launching python at the command line, from which $PYTHONPATH, as well as $PYTHONSTARTUP, are "visible", no matter what python is launched.))

thanks for sticking with me on these, Let's hope they help others,
David
ps l think the console(s) messaging is super!

gandreas
Immortal
Posts: 1464
Joined: Wed Feb 04, 2004 6:02 pm
Contact:

Post by gandreas » Thu Nov 09, 2006 9:40 am

drw wrote: On Launch, no matter what version/location I use, I get the following, or similar, error?warning:

17:17:39 unable to put task 8319(/Library/Frameworks/Python.framework/Versions/Current/bin/python) into same group as self
looks like a permissions problem... is it potentially serious?
...
No, it just attempts to make the editor handling python support process owned by ScrIDE, so that if ScrIDE crashes, it doesn't leave a python process running. So it's more a safeguard in case things go wrong, as opposed to any sort of real problem (and I've no idea why it will work one time, and the next time you run it it won't).
Now, about $PYTHONPATH (the python shell variable):
How do I make ScrIDE look in at it for paths for *.py files?
(or an I missing something really basic.. (I'm used to launching python at the command line, from which $PYTHONPATH, as well as $PYTHONSTARTUP, are "visible", no matter what python is launched.))
The problem is that when you launch python from your favorite shell, it gets all the environment variables the shell does (or whatever else launches it). So if you were to launch ScrIDE from the command line (via the "open" command) you'd get the same env vars as your shell.

Unfortunately, you normally launch it from the Finder, so it only gets the env vars that the Finder knows about (which aren't many). There is an answer, however (though it will require logging out and in to activate). If the file "~/.MacOSX/environment.plist" exists, the various keys in that plist will be set as environment variables for all GUI apps, so you can create/edit that to include your python variables.

Unfortunately, while ScrIDE extensions can access env vars, there currently isn't a way to set them...
thanks for sticking with me on these, Let's hope they help others,
David
ps l think the console(s) messaging is super!
That's the exact benefit of a webboard like this.

(And yes, I'm quite fond of the console as well - there are some undocumented preferences that turns on great gory details which have been the only way I've been able to debug some of the "rpc" issues to get debugging working).

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest