Re: [Pythonmac-SIG] building non-Framework Python 2.4.1 on Tiger

2005-05-04 Thread Craig Amundsen
Hi -

> However, I suppose that a straight build
> from the Python sources will yield just what you want, it's probably
> the Framework build that requires special action.

That is correct. I built 2.4 from source and had to do a bit of
command-line jiggling to get the Framework build instead of the
vanilla Unix variety.

- Craig
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] building rpy

2005-07-10 Thread Craig Amundsen
Hi -

I've built R and rpy on a couple of Macs using a bashed together
combination of the instructions in

http://rpy.sourceforge.net/faq.html

and

http://www.economia.unimi.it/R/RMACOSX-FAQ.html

The key bit is that R needs to be built as a shared library.

>From the rpy FAQ:
./configure --enable-R-shlib

To make R a Framework build, from the Building R FAQ:
./configure --with-blas='-framework vecLib' --with-lapack --with-aqua

Combining these two collections of configure options gets us
./configure --with-blas='-framework vecLib' --with-lapack --with-aqua
--enable-R-shlib

After configuring, making and installing R as above, rpy should build just fine.

- Craig
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Python 2.4.1 not replacing earlier versions.

2005-08-30 Thread Craig Amundsen
Hi -

On 8/30/05, Simon Brunning <[EMAIL PROTECTED]> wrote:

> I think that may be something to do with the fact that the original
> version of Python that came with the machine is still 'in charge'.
> Starting Python on the command line gives me version 2.3.5 - and when
> I installed appscript, it beccame available to Python 2.3.5 but not to
> Python 2.4.

The python you installed lives in /usr/local/bin. If you want it to
run when you type 'python' at the prompt you need to make sure that
/usr/local/bin is before /usr/bin in your path.

> Now, I can appreciate that changing the version of Python that the OS
> uses might not be a good idea, but how do I get 2.4.1 working with
> appscript and PyObjC? Or is that a bad idea?

When you build modules they are available to the version of python
that built them. So if you build appscript (and its many dependencies)
and PyObjC with 2.4.1, you'll be able to load them with 2.4.1.

- Craig

PS - Oh, and don't try to replace the Apple-supplied Python with a
newer version. Down that path lies madness and reinstallation of the
system. With proper attention, multiple versions of Python can live
quite happily on the Mac.
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Python 2.4.1 not replacing earlier versions.

2005-08-31 Thread Craig Amundsen
Hi -

> Or I can just invoke the /usr/local/bin version explicitly, yes? Seems
> to work...
> 
> How do I specify that in a shebang line? I tried "#!/usr/local/bin
> python", but I got a "bad interpreter: Permission denied" error
> message.

Did you mean #! /usr/local/bin/python
or  #! /usr/local/bin python ?

The first line works for me, the second does not.

- Craig
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] inputing multi-digit numbers

2005-11-10 Thread Craig Amundsen
Hi -

> > Thank you. That gives me something closer to a list, but the output is now: 
> > ['939\n', '936\n', '937\n', '885\n', '886\n', '887\n', '171\n', '19\n', ...]

You could do:

inf = open(fileName)
numbers = inf.read().splitlines()

splitlines() is smarter than readlines()

- Craig
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] MySQLdb Lib Help

2006-01-16 Thread Craig Amundsen
Hi -

> >>> import MySQLdb
> Traceback (most recent call last):
>   File "", line 1, in ?
> ImportError: No module named MySQLdb

What is the output from

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

That's where you should find the MySQLdb directory if it got installed
correctly.

- Craig
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] controlling iTunes with appscript

2006-11-28 Thread Craig Amundsen

Hi -

I've had an iTunes appscript question nagging at me, so I'll add another
question...

I've moved a bunch of my files around and rather than do the 1 at a time
showing iTunes the new location, I'd like to use appscript to set the
location of the moved songs to the new value.

Based on my reading it looks like
track.location.set('/Path/To/The/File')
should do what I want.

The trouble I'm having is getting iTunes to give me a list of all the tracks
in the library. I've tried various versions of things in the wiki and hints
I've found via Google, but none have worked for me. Is there a canonical
appscript call into iTunes that will return a list of all tracks in the
library?

Thanks,
- Craig
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] controlling iTunes with appscript

2006-12-01 Thread Craig Amundsen
Hi -

I finally had time to play around with appscript, and can now get the
list of tracks. For reasons I don't understand, if I try to get all
the file_tracks in the library, iTunes shoots up to about 80% CPU
utilization and never comes back, even if I set the timeout to 15
minutes. But if I put all the songs in a playlist and get the songs
with

app('iTunes').sources[1].user_playlists['PlaylistOfAllSongs'].file_tracks.get()

it takes a while, but eventually comes back with list of tracks.

> Just FYI if you don't know already, iTunes uses aliases to keep track
> of file locations, so if you're not moving across volumes, you
> shouldn't have to do anything at all.

> You may end up needing to use HFS rather than POSIX paths, or even
> aliases, depending on what iTunes expects.

If I get the location of a track eg,

>>> t.location.get()
macfile.Alias(u'/Volumes/FirewireHD/iTunes/Air/Talkie Walkie/02 Cherry
Blossom Girl.mp3')

the location is definitely a macfile.Alias

I am moving my songs between Volumes, so I do have to do something. If I try:

>>> f = macfile.Alias(u'/Volumes/RAID/iTunes/Air/Talkie Walkie/02
Cherry Blossom Girl.mp3')
>>> t.location.set(f)

I get this error:

Traceback (most recent call last):
  File "", line 1, in 
  File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/aeosa/appscript/reference.py",
line 281, in __call__
raise CommandError(self, (args, kargs), e)
appscript.reference.CommandError: 'NoneType' object has no attribute '__name__'
Failed command:
app(u'/Applications/iTunes.app').sources.ID(41).user_playlists.ID(388392).file_tracks.ID(388445).location.set(macfile.Alias(u'/Volumes/RAID500/iTunes/Air/Talkie
Walkie/02 Cherry Blossom Girl.mp3'))

Any hints would be greatly appreciated.

Thanks,
- Craig
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] controlling iTunes with appscript

2006-12-04 Thread Craig Amundsen

Hi -

On Fri, Dec 01, 2006 at 07:45:38PM -0800, Craig Amundsen wrote:

> >>> t.location.set(f)

Yeah, you can't do this.  If you look in the dictionary (for example,
opening it in Script Editor), you'll see:

location (alias, r/o) : the location of the file represented by this track

The location property is read only.



I was afraid of that. Thanks for letting me know.

The only way I can think to move files across disks in iTunes and have

the references stay intact is to use the "Consolidate Library"
command.  To do that, reset the iTunes Music Library location
(Preferences > Advanced > General) to where you want the files to go,
then choose "Consolidate Library" from the Advanced menu, and all your
music will move there.



I've tried that. I'm trying to move my library from one external Firewire
drive to an external RAID1 setup. Doing the consolidate moved about 10% of
the files and then crapped out with an error that said something about being
able to read/write a drive. Repeated attempts to consolidate the library now
die with the read/write error immediately. I don't think it's a problem with
either drive since I can read and write from both of them. It may be that
RAID is too slow to keep up with whatever iTunes is trying to do. I was
hoping I could do a manual copy and then update all the locations via
appscript. This having the advantage of allowing me to preserve metadata. I
guess it's time to forget about the metadata since I'm not going to do the
one-at-a-time location update from within iTunes.

- Craig
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig