A couple MacPython questions...

Skip Montanaro skip at mojam.com
Sun Dec 26 16:51:17 EST 1999


I downloaded MacPython 1.5.2 to my Mac and have a couple questions.

1. The Mac's notion of the current directory seems askew to me.  If I ask
   for the current directory I get

    >>> os.getcwd()
    'Macintosh HD:Applications:Python 1.5.2c1'

   This seems plausible.  If I try to change directory to "Macintosh HD" I get
   an error:

       >>> os.chdir("Macintosh HD")
       Traceback (innermost last):
	 File "<input>", line 1, in ?
       error: (2, 'No such file or directory')

   Okay, try appending the colon, which works much better:

       >>> os.chdir("Macintosh HD:")
       >>> os.getcwd()
       'Macintosh HD:'
       >>> os.listdir(os.getcwd())
       ['Apple Extras', 'AppleShare PDS', 'Applications', 'Assistants', 'Cleanup At
       Startup', 'Desktop DB', 'Desktop DF', 'Desktop Folder', 'DesktopPrinters
       DB', 'Documents', 'dot_clear.gif', 'iMac Read Me', 'Installer Log File',
       'Installer Logs', 'Internet', 'Late Breaking News', 'Mac OS Read Me Files',
       'Microsoft Media Player', 'OneClick Folder', 'OpenFolderListDF\015',
       'People', 'ReadMe.ssh', 'Shutdown Check', 'System Folder', 'Temporary
       Items', 'TheFindByContentFolder', 'TheVolumeSettingsFolder', 'Trash',
       'Users', 'Utilities', 'VM Storage', 'Web Pages']

   Now, if I try to change directory to my Desktop Folder, it lets me, but
   reports it as empty:

       >>> os.chdir("Macintosh HD:Desktop Folder:")
       >>> os.listdir(os.getcwd())
       []
       >>> os.getcwd()
       'Macintosh HD:Desktop Folder'

   I can see my desktop isn't devoid of entries.

   I imagine I misunderstand the Mac's idea of building directories.
   Apparently the Mac's : doesn't mean quite the same thing as Unix's /.
   Any tutorial out there for a Unix weenie?

2. I miss being able to use command line editing when facing the Python
   prompt.  Readline seems to be unavailable (not really surprising).  Is
   there something similar available for Just van Rossum's MacPython IDE?

3. Greg Stein announced a little type checker to python-dev over the
   weekend.  I downloaded it and tried using BuildApplet to create an applet
   from check.py.  I got the following errors:

    shift: no mem in addchild
    Traceback (innermost last):
      File "flap:jack:Python:Mac:scripts:BuildApplet.py", line 67, in ?
      File "flap:jack:Python:Mac:scripts:BuildApplet.py", line 22, in main
      File "flap:jack:Python:Mac:scripts:BuildApplet.py", line 54, in
      buildapplet
      File "Macintosh HD:Applications:Python 1.5.2c1:Mac:Lib:buildtools.py",
      line 73, in process
	code = compile(text, filename, "exec")
    MemoryError

Any ideas what might be wrong?

Thx,

Skip Montanaro | http://www.mojam.com/
skip at mojam.com | http://www.musi-cal.com/
847-971-7098   | Python: Programming the way Guido indented...




More information about the Python-list mailing list