[ python-Bugs-1004810 ] Carbon.File fails if server vol is mounted after launch

SourceForge.net noreply at sourceforge.net
Sat Aug 14 22:03:34 CEST 2004


Bugs item #1004810, was opened at 2004-08-06 20:51
Message generated for change (Comment added) made by jackjansen
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1004810&group_id=5470

Category: Macintosh
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Paul Pharr (pharr)
Assigned to: Jack Jansen (jackjansen)
Summary: Carbon.File fails if server vol is mounted after launch

Initial Comment:


On MacOs X 10.3.x (with the stock Python 2.3).

Carbon.File.FSSpec(theFile) will fail with a -120 
(Directory Not Found) error if theFile is on a server 
volume which was mounted after the script was 
launched.

In actuality, it may be a little more complex, because if 
there is only a single server volume mounted, then 
Carbon.File sometimes will not fail until the volume is 
mounted, unmounted, and remounted a few times. 
Mounting two or more volumes causes the situation to 
become more consistently reproducible.

What is going on is that each application's instance of 
the Carbon File Manager depends on being notified by 
the MacOS X operating system when volumes are 
mounted and unmounted through the application's 
runloop. Since python scripts do not implement a 
runloop, the running python process' carbon file manager 
never gets a chance to see these notifications and 
consequently it's internal data structures describing the 
state of the mounted volumes become out of date if 
volumes are mounted or unmounted repeatedly from 
other processes. This causes most Carbon.File calls to 
fail when manipulating files on a server volume if that 
volume is mounted while the script is running.

My situation is an automated build script which wants to 
continue running while mounting and unmounting server 
volumes onto which to copy the resulting build products. 
After the first two builds (and mounting and unmounting 
two AFP volumes twice), all Carbon.File calls 
subsequently will fail until the python script is 
relaunched.

It seems like there would be a way to get Carbon.File to 
be able to look a little harder for these volumes, but I 
haven't found a good workaround other than to call a 
sub-script for any operation which requires Carbon.File.


----------------------------------------------------------------------

>Comment By: Jack Jansen (jackjansen)
Date: 2004-08-14 22:03

Message:
Logged In: YES 
user_id=45365

Paul,
I've always known that there were potential problems with some of the 
FSSpec calls when  you have no runloop, but you're the first one (in 
about 10 years:-) to actually give the impression you understand what 
goes on. While I don't think I can fix this in Python itself (adding a 
runloop is hardly an option) I could document what a user would have to 
do, and/or provide a helper method that would execute that code or 
something, but I would first need to know what it is you actually have to 
do in the runloop.

Do you happen to know this? And/or do you have references to the 
specific sections of Apple documentation where this is described?

BTW: does the problem alson happen if you go from filename to FSRef to 
FSSpec? And at which stage (fsr=FSRef(filename) or fss=FSSpec(fsr))? 

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1004810&group_id=5470


More information about the Python-bugs-list mailing list