xlrd question

has has.temp3 at virgin.net
Sun Aug 5 05:31:45 EDT 2007


On Aug 4, 1:48 am, JYOUN... at kc.rr.com wrote:

> I ran your code which gave me this:
>
> >>> import sys, xlrd; print sys.version; print xlrd.__file__
>
> 2.3.5 (#1, Jan 30 2006, 13:30:29)
> [GCC 3.3 20030304 (Apple Computer, Inc. build 1819)]
> /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site -packages/
> xlrd/__init__.pyc

Note that:

/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/
site-packages

is actually just a symlink to:

/Library/Python/2.3/site-packages

While third-party modules do usually go in python2.x/site-packages,
Apple don't like users messing about in /System so their stock Python
installation keeps third-party modules under /Library instead.

The exact location varies depending on OS version: on 10.3 it's /
Library/Python/2.3; on 10.4 it's /Library/Python/2.3/site-packages.
Modules installed via DistUtils/EasyInstall will be placed in the
appropriate location automatically.

For more information on installing DistUtils packages, see:

http://docs.python.org/inst/inst.html


> and as far as I can tell, the runxlrd.py file is located here (where I had drug this folder
> originally):
>
> Macintosh HD/xlrd-0.6.1/scripts/runxlrd.py

Nope,  DistUtils will copy all modules to site-packages as part of the
installation procedure. If you're a developer you'll probably want to
keep the original distribution around as it'll contain documentation,
examples, etc. which you'll want to refer to when writing your own
scripts. End-users of your scripts won't need it though.

([OT] Tip: dumping user files under / is poor etiquette; that's what
your home directory under /Users is for.)


> While I'm talking about Excel, is there any other program (for Python) that can edit Excel files?

You can script Excel directly from Python via appscript which talks to
scriptable Mac apps via the same API as AppleScript:

http://appscript.sourceforge.net

I don't do any Excel scripting myself, but Matt Neuburg includes a
nice example in this article on the Ruby version of appscript (which
has a similar syntax):

http://www.oreillynet.com/pub/a/mac/2007/02/27/replacing-applescript-with-ruby.html

If you need more info just ask.

HTH

has
--
http://appscript.sourceforge.net
http://rb-appscript.rubyforge.org




More information about the Python-list mailing list