[Pythonmac-SIG] 'import site' failed. Trouble starting python. What does this mean?

2005-07-19 Thread Louis Pecora
I've been having trouble running Python from BBEdit and the MacPython 
IDE (neither works) so I tried to start from the terminal.  I get this 
message:

louispec% python -v
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
'import site' failed; traceback:
ImportError: No module named site
Python 2.3 (#1, Sep 13 2003, 00:49:11)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>>


If I type "help", I get:

 >>> help
Traceback (most recent call last):
  File "", line 1, in ?
NameError: name 'help' is not defined


What's going on?  Anyone know?  Right now I'm Pythonless. 

Any info appreciated.

Running on a G4 Al PB (1.25 GHz), OS X 10.3.8.  Panther Add ons 
installed.  WxPython installed.  Matplotlib installed.  Using Apple's 
Python AFAIK.

-- 
Cheers,

Lou Pecora

Code 6362
Naval Research Lab
Washington, DC  20375
USA
Ph:  +202-767-6002
email:  [EMAIL PROTECTED]

___
Pythonmac-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/pythonmac-sig


[Pythonmac-SIG] Python Eggs and Mac OS version compatibility

2005-07-19 Thread Kevin Dangoor
I have been packaging up some of my python packages in eggs:
http://peak.telecommunity.com/DevCenter/PythonEggs

Basically, an egg has everything you need to use a package,
ready-to-run... including binary versions of extensions. It's a nice
format because it enables people to just run an "easy_install" program
to get a package, no compiler required. (Which is a bigger win on
Windows, to be sure, but even on the Mac it means that casual
scripters wouldn't need to install Developer Tools).

The way eggs are created right now generates a package name that looks
something like this:

[PackageName]-[Version]-py[PythonVersion]-darwin-8.2.0-Power_Macintosh.egg

As coded currently, updating from Mac OS 10.4.1 to 10.4.2 (which
bumped the Darwin version from 8.1.0 to 8.2.0), means that any eggs
compiled under 10.4.1 won't work any more under 10.4.2, because
setuptools is checking the full platform to see if it matches.

That's more than a little aggressive, compatibility-wise. We can
redefine for Mac OS what an appropriate platform string would be and
what the compatibility rules are.

That's where I need some help, because I don't know for certain what
the compatibility rules are. From reading this list for the past
several months, I have an idea:

1) an extension built for Python 2.4 on 10.3 should work under 10.4
2) an extension built for Python 2.4 on 10.4 might work on 10.3, but
don't count on it.

Would it then make sense for setuptools to do something like this:

- declare the platform as it does now (eg, darwin-8.2.0)
- specify that an egg is compatible if it's major version (8) is <=
your machine's major version.

Are there other compatibility gotchas or would that do the trick?

Kevin
___
Pythonmac-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Python Eggs and Mac OS version compatibility

2005-07-19 Thread Ronald Oussoren

On 19-jul-2005, at 16:56, Kevin Dangoor wrote:
>
> That's where I need some help, because I don't know for certain what
> the compatibility rules are. From reading this list for the past
> several months, I have an idea:
>
> 1) an extension built for Python 2.4 on 10.3 should work under 10.4
> 2) an extension built for Python 2.4 on 10.4 might work on 10.3, but
> don't count on it.
>
> Would it then make sense for setuptools to do something like this:
>
> - declare the platform as it does now (eg, darwin-8.2.0)
> - specify that an egg is compatible if it's major version (8) is <=
> your machine's major version.
>
> Are there other compatibility gotchas or would that do the trick?

The kernel release (e.g. 8.2.0) isn't very interesting. Luckily the  
kernel version increases in sync with the OS version at the moment,  
which means your suggestion works just fine in practice. I wouldn't  
worry about the semantic difference between kernel versions and OS  
releases at the moment.

To make live even more interesting, that may change in the  
future :-). The developer tools have an SDK feature, this makes it  
possible to build software on 10.4 that will run reliably on an  
earlier version of the OS. Python's build system currently doesn't  
support this (aka "autoconf sucks"), but that will probably change in  
the future.

Ronald
___
Pythonmac-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] 'import site' failed. Trouble starting python. What does this mean?

2005-07-19 Thread Bob Ippolito

On Jul 19, 2005, at 3:36 AM, Louis Pecora wrote:

> I've been having trouble running Python from BBEdit and the MacPython
> IDE (neither works) so I tried to start from the terminal.  I get this
> message:
>
> louispec% python -v
> # installing zipimport hook
> import zipimport # builtin
> # installed zipimport hook
> 'import site' failed; traceback:

That's no good.  Have you been screwing with environment variables?   
PYTHONPATH, etc.?

Did the files get deleted from /System/Library/Frameworks/ 
Python.framework/Versions/2.3/lib/python2.3 ?  Or were the  
permissions mangled?

-bob

___
Pythonmac-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Python Eggs and Mac OS version compatibility

2005-07-19 Thread Bob Ippolito

On Jul 19, 2005, at 4:56 AM, Kevin Dangoor wrote:

> I have been packaging up some of my python packages in eggs:
> http://peak.telecommunity.com/DevCenter/PythonEggs
>
> Basically, an egg has everything you need to use a package,
> ready-to-run... including binary versions of extensions. It's a nice
> format because it enables people to just run an "easy_install" program
> to get a package, no compiler required. (Which is a bigger win on
> Windows, to be sure, but even on the Mac it means that casual
> scripters wouldn't need to install Developer Tools).
>
> The way eggs are created right now generates a package name that looks
> something like this:
>
> [PackageName]-[Version]-py[PythonVersion]-darwin-8.2.0- 
> Power_Macintosh.egg
>
> As coded currently, updating from Mac OS 10.4.1 to 10.4.2 (which
> bumped the Darwin version from 8.1.0 to 8.2.0), means that any eggs
> compiled under 10.4.1 won't work any more under 10.4.2, because
> setuptools is checking the full platform to see if it matches.
>
> That's more than a little aggressive, compatibility-wise. We can
> redefine for Mac OS what an appropriate platform string would be and
> what the compatibility rules are.

Pick out the sw_vers function from here:
http://svn.red-bean.com/bob/py2app/trunk/src/bdist_mpkg/tools.py

Use that instead of the uname (darwin-8.2.0-Power_Macintosh).

e.g.
'macosx-' + '.'.join(map(str, sw_vers().version[:2]))

Then contribute it to setuptools so it gets used in bdist_egg (or  
distutils, really).

-bob

___
Pythonmac-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] 'import site' failed. Trouble starting python. What does this mean?

2005-07-19 Thread Louis Pecora
Bob Ippolito wrote:

>On Jul 19, 2005, at 3:36 AM, Louis Pecora wrote:
>
>  
>
>>I've been having trouble running Python from BBEdit and the MacPython
>>IDE (neither works) so I tried to start from the terminal.  I get this
>>message:
>>
>>louispec% python -v
>># installing zipimport hook
>>import zipimport # builtin
>># installed zipimport hook
>>'import site' failed; traceback:
>>
>>
>
>That's no good.  Have you been screwing with environment variables?   
>PYTHONPATH, etc.?
>  
>
Yeah, I know I have trouble.  I haven't messed with any variables.  The 
whole thing worked fine, then after a trip to a conference where I 
barely used the computer,  Python was dead.

Disk First Aid repaired some of the directory (I think that's what it 
does) involving some Python Frameworks, but then ground to a halt with a 
cryptic message that it couldn't fix whatever it is that broken. 

I have ordered DiskWarrior and will try that.  I suspect something is 
broken in the directory.  But then I'm not an expert, maybe it's 
something in Python.

>Did the files get deleted from /System/Library/Frameworks/ 
>Python.framework/Versions/2.3/lib/python2.3 ?  Or were the  
>permissions mangled?
>
Not that I know of, but down in the directory you mention just above I have the 
following files shown below (sorry for the long list).  I notice that no files 
with names beginning with a letter past 'p' are there.  I'm not sure what's 
supposed to be there, but this looks suspicious.  

Opinions?

Files in /System/Library ... lib/python2.3:

__future__.py
__future__.pyc
__future__.pyo
__phello__.foo.py
__phello__.foo.pyc
__phello__.foo.pyo
_strptime.py
_strptime.pyc
_strptime.pyo
aifc.py
aifc.pyc
aifc.pyo
anydbm.py
anydbm.pyc
anydbm.pyo
asynchat.py
asynchat.pyc
asynchat.pyo
asyncore.py
asyncore.pyc
asyncore.pyo
atexit.py
atexit.pyc
atexit.pyo
audiodev.py
audiodev.pyc
audiodev.pyo
base64.py
base64.pyc
base64.pyo
BaseHTTPServer.py
BaseHTTPServer.pyc
BaseHTTPServer.pyo
Bastion.py
Bastion.pyc
Bastion.pyo
bdb.py
bdb.pyc
bdb.pyo
binhex.py
binhex.pyc
binhex.pyo
bisect.py
bisect.pyc
bisect.pyo
bsddb
calendar.py
calendar.pyc
calendar.pyo
cgi.py
cgi.pyc
cgi.pyo
CGIHTTPServer.py
CGIHTTPServer.pyc
CGIHTTPServer.pyo
cgitb.py
cgitb.pyc
cgitb.pyo
chunk.py
chunk.pyc
chunk.pyo
cmd.py
cmd.pyc
cmd.pyo
code.py
code.pyc
code.pyo
codecs.py
codecs.pyc
codecs.pyo
codeop.py
codeop.pyc
codeop.pyo
colorsys.py
colorsys.pyc
colorsys.pyo
commands.py
commands.pyc
commands.pyo
compileall.py
compileall.pyc
compileall.pyo
compiler
config
ConfigParser.py
ConfigParser.pyc
ConfigParser.pyo
Cookie.py
Cookie.pyc
Cookie.pyo
copy_reg.py
copy_reg.pyc
copy_reg.pyo
copy.py
copy.pyc
copy.pyo
csv.py
csv.pyc
csv.pyo
curses
dbhash.py
dbhash.pyc
dbhash.pyo
difflib.py
difflib.pyc
difflib.pyo
dircache.py
dircache.pyc
dircache.pyo
dis.py
dis.pyc
dis.pyo
distutils
doctest.py
doctest.pyc
doctest.pyo
DocXMLRPCServer.py
DocXMLRPCServer.pyc
DocXMLRPCServer.pyo
dumbdbm.py
dumbdbm.pyc
dumbdbm.pyo
dummy_thread.py
dummy_thread.pyc
dummy_thread.pyo
dummy_threading.py
dummy_threading.pyc
dummy_threading.pyo
email
encodings
FCNTL.py
FCNTL.pyc
FCNTL.pyo
filecmp.py
filecmp.pyc
filecmp.pyo
fileinput.py
fileinput.pyc
fileinput.pyo
fnmatch.py
fnmatch.pyc
fnmatch.pyo
formatter.py
formatter.pyc
formatter.pyo
fpformat.py
fpformat.pyc
fpformat.pyo
ftplib.py
ftplib.pyc
ftplib.pyo
getopt.py
getopt.pyc
getopt.pyo
getpass.py
getpass.pyc
getpass.pyo
gettext.py
gettext.pyc
gettext.pyo
glob.py
glob.pyc
glob.pyo
gopherlib.py
gopherlib.pyc
gopherlib.pyo
gzip.py
gzip.pyc
gzip.pyo
heapq.py
heapq.pyc
heapq.pyo
hmac.py
hmac.pyc
hmac.pyo
hotshot
htmlentitydefs.py
htmlentitydefs.pyc
htmlentitydefs.pyo
htmllib.py
htmllib.pyc
htmllib.pyo
HTMLParser.py
HTMLParser.pyc
HTMLParser.pyo
httplib.py
httplib.pyc
httplib.pyo
idlelib
ihooks.py
ihooks.pyc
ihooks.pyo
imaplib.py
imaplib.pyc
imaplib.pyo
imghdr.py
imghdr.pyc
imghdr.pyo
imputil.py
imputil.pyc
imputil.pyo
inspect.py
inspect.pyc
inspect.pyo
keyword.py
keyword.pyc
keyword.pyo
lib-dynload
lib-old
lib-tk
LICENSE.txt
linecache.py
linecache.pyc
linecache.pyo
locale.py
locale.pyc
locale.pyo
logging
macpath.py
macpath.pyc
macpath.pyo
macurl2path.py
macurl2path.pyc
macurl2path.pyo
mailbox.py
mailbox.pyc
mailbox.pyo
mailcap.py
mailcap.pyc
mailcap.pyo
markupbase.py
markupbase.pyc
markupbase.pyo
mhlib.py
mhlib.pyc
mhlib.pyo
mimetools.py
mimetools.pyc
mimetools.pyo
mimetypes.py
mimetypes.pyc
mimetypes.pyo
MimeWriter.py
MimeWriter.pyc
MimeWriter.pyo
mimify.py
mimify.pyc
mimify.pyo
modulefinder.py
modulefinder.pyc
modulefinder.pyo
multifile.py
multifile.pyc
multifile.pyo
mutex.py
mutex.pyc
mutex.pyo
netrc.py
netrc.pyc
netrc.pyo
new.py
new.pyc
new.pyo
nntplib.py
nntplib.pyc
nntplib.pyo
ntpath.py
ntpath.pyc
ntpath.pyo
nturl2path.py
nturl2path.pyc
nturl2path.pyo
opcode.py
opcode.pyc
opcode.pyo
optparse.py
optparse.pyc
optparse.pyo
os.py
os.pyc
os.pyo
os2emxpath.py
os2emxpath.pyc
os2emxpath.pyo
pdb.doc
pdb.py
pdb.pyc
pdb.pyo
pickle.py
pickle.pyc
pickle.pyo
pickletools.py
pickletools.pyc
pi

Re: [Pythonmac-SIG] 'import site' failed. Trouble starting python. What does this mean?

2005-07-19 Thread Bob Ippolito

On Jul 19, 2005, at 1:33 PM, Louis Pecora wrote:

> Bob Ippolito wrote:
>
>
>> On Jul 19, 2005, at 3:36 AM, Louis Pecora wrote:
>>
>>
>>
>>
>>> I've been having trouble running Python from BBEdit and the  
>>> MacPython
>>> IDE (neither works) so I tried to start from the terminal.  I get  
>>> this
>>> message:
>>>
>>> louispec% python -v
>>> # installing zipimport hook
>>> import zipimport # builtin
>>> # installed zipimport hook
>>> 'import site' failed; traceback:
>>>
>>>
>>>
>>
>> That's no good.  Have you been screwing with environment variables?
>> PYTHONPATH, etc.?
>>
>>
>>
> Yeah, I know I have trouble.  I haven't messed with any variables.   
> The
> whole thing worked fine, then after a trip to a conference where I
> barely used the computer,  Python was dead.
>
> Disk First Aid repaired some of the directory (I think that's what it
> does) involving some Python Frameworks, but then ground to a halt  
> with a
> cryptic message that it couldn't fix whatever it is that broken.
>
> I have ordered DiskWarrior and will try that.  I suspect something is
> broken in the directory.  But then I'm not an expert, maybe it's
> something in Python.
>
>
>> Did the files get deleted from /System/Library/Frameworks/
>> Python.framework/Versions/2.3/lib/python2.3 ?  Or were the
>> permissions mangled?
>>
>>
> Not that I know of, but down in the directory you mention just  
> above I have the following files shown below (sorry for the long  
> list).  I notice that no files with names beginning with a letter  
> past 'p' are there.  I'm not sure what's supposed to be there, but  
> this looks suspicious.
>
> Opinions?
>
> Files in /System/Library ... lib/python2.3:

That list is incomplete, files are missing.  Reinstall Mac OS X or  
upgrade to 10.4.

-bob

___
Pythonmac-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/pythonmac-sig


[Pythonmac-SIG] not "MacPython" - right place?

2005-07-19 Thread William K
I'm not sure if this is the place - browsing the list shows everyone  
talking about MacPython or building their own.  I'm just interested  
in figuring out something on Apple's included Python.  Major Python  
newbie here (a couple Python books in the mail).

When I do an install with no options, it installs in /System/ 
Library/...  That doesn't sound like a good idea - /System should be  
for Apple stuff and the occassional kext.  Is there a standard user- 
plugin folder for Python on Mac OS X (like /Library/Python)?  And how  
would I specify that in a python setup.py install command?  The  
distutils documentation didn't help - developer-oriented.

for Mac OS 10.4.

I remember trying something back in Panther, but I didn't have the  
time or need to pursue it very far.  I installed a module somehow in / 
Library/Python and it's still there.

-
William Kyngesburye <[EMAIL PROTECTED]>
http://www.kyngchaos.com/

"I ache, therefore I am.  Or in my case - I am, therefore I ache."

- Marvin
___
Pythonmac-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] not "MacPython" - right place?

2005-07-19 Thread Bob Ippolito

On Jul 19, 2005, at 5:38 PM, William K wrote:

> I'm not sure if this is the place - browsing the list shows everyone
> talking about MacPython or building their own.  I'm just interested
> in figuring out something on Apple's included Python.  Major Python
> newbie here (a couple Python books in the mail).

Apple's included Python is also considered MacPython.

> When I do an install with no options, it installs in /System/
> Library/...  That doesn't sound like a good idea - /System should be
> for Apple stuff and the occassional kext.  Is there a standard user-
> plugin folder for Python on Mac OS X (like /Library/Python)?  And how
> would I specify that in a python setup.py install command?  The
> distutils documentation didn't help - developer-oriented.
>
> for Mac OS 10.4.
>
> I remember trying something back in Panther, but I didn't have the
> time or need to pursue it very far.  I installed a module somehow in /
> Library/Python and it's still there.

The path it's using is just a symlink to /Library/Python/2.3/site- 
packages/, so while it displays /System/... it's really not putting  
it there.  Python code anyway, scripts it will put in that tree  
unless you pass options during the install.  See python setup.py -- 
help install.

-bob

___
Pythonmac-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/pythonmac-sig


[Pythonmac-SIG] Posting KeyDown events to NSResponder instances?

2005-07-19 Thread Steve Spicklemire

Hi Folks,

I'm guessing this is supposed to be easy.. but I've spend a good  
chunk of time searching for an approach, but none of the suggestions  
I've found is working for me. ;-( I need to 'manually' send a keyDown  
event (left arrow actually) to a QTMovieView instance. The movie view  
is in a window that's an objective-c subclass of NSWindow. The window  
controller is a pyObjC instance. Is there an easy way to do this? The  
NSEvent constructor for 'keyEvents' is a bit overwhelming,  
nonetheless.. I managed to get it working from my objective-c  
NSWindow subclass instance.. but no matter how I try to post the  
keyDown it never behaves the same as actually hitting the keyboard  
when the QTMovieView has focus. In fact.. it seems that when I call  
qtView.keyDown_(event) from the window controller the event is  
ignored by the qtView and passed on tp the window's keyDown:, but  
when I hit a real key... the even is 'swallowed' by the view and the  
window never sees it. There something about the responder chain I'm  
not getting here!

Any thoughts are welcome.

thanks,
-steve

___
Pythonmac-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/pythonmac-sig