Forum: Poser Python Scripting


Subject: shutil Advisory

PoseWorks opened this issue on Jan 15, 2006 ยท 6 posts


PoseWorks posted Sun, 15 January 2006 at 12:37 AM

Avoid the shutil module when scripting for Poser 6. This module appears to be broken on a large number of installations.


nruddock posted Sun, 15 January 2006 at 8:12 AM

Broken in some other way than the docs mention (lost resources, file types and creator codes on MacOS)?


PoseWorks posted Sun, 15 January 2006 at 11:51 PM

A large number of P6 users receive this error with any usage of shutil: File "C:Program FilesCurious LabsPoser 6RuntimePythonlibshutil.py", line 29, in copyfile fdst = open(dst, 'wb') IOError: Invalid argument: wb


nruddock posted Mon, 16 January 2006 at 5:18 AM

The most likely cause is that the destination file name contains an invalid character.
At least this is the only way I can get this error.

E.g.

import shutil<br></br><br></br>shutil.copyfile("I:/Temp/ro/test.txt", "I:/Temp/ro/test*1.txt")

On a Mac (or any *nix system) you'd get away with this, but not on Windows.


nruddock posted Mon, 16 January 2006 at 1:46 PM

Further investigation reveals that the real problem is in the error checking of open_the_file in fileobject.c
The interpretation of the error number returned by Windows was corrected on April 8th 2002, in release 2.2.1
See -> Diff for change


PoseWorks posted Mon, 16 January 2006 at 5:54 PM

I know the file name is valid--Poser would have barfed and died long before if it hadn't been. Thanks for the investigation, nruddock. I'm still not certain why some users have problems with this while others don't, or why this does not appear to be an issue for Poser 5 users (who also use Py 2.2). In any event, avoid shutil for P6 projects.