Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Sep 18 2:50 am)
Must confess I've never used that script.... but it uses Gzip, which doesn't always work with Winzip. I've found that WinRAR always handles Gzipped files correctly.
My python page
My ShareCG freebies
Thanks, Ockham. I'll try WinRAR, then. :)
===========================sigline======================================================
Cage can be an opinionated jerk who posts without thinking. He apologizes for this. He's honestly not trying to be a turkeyhead.
Cage had some freebies, compatible with Poser 11 and below. His Python scripts were saved at archive.org, along with the rest of the Morphography site, where they were hosted.
Hope my post is not too late. Yesterday I wanted to compress my entire 'libraries' folder and I wasn't happy with problem with WinZip.
It appears to me that WinZip chokes while making a temp file for extraction. It uses the entire filepath (with driveletter and colon) stored in the gzip header and appends it to your temp directory, thus an invalid filename. Here's a simple fix. Put the following code block above the
os.path.walk(dirToCompress, visit, arg)
line at the bottom of the script.
if ((winver==1) and (dirToCompress[1]==":")):<br></br> os.chdir( dirToCompress[:3] ) # change to drive and root of dirToCompress<br></br> dirToCompress = dirToCompress[3:] # strip the 'driveletter:' from the left<br></br>
There are a few other problems with the script.
When it searches for a file extension ('string.find()'), it should do a case insensitive search. It currently will miss a file named 'MyChar.CR2'. I should also probably do a 'string.rfind()' so that it checks the end string.
GzipFile is storing the 'compressed filename' in the header. I would rather have the 'source filename' stored so that I don't have a filename conflict while extracting to the same location.
Also, my preference is to have the gzip header filepath start at my runtime directory, not from the root of the drive.
I have a version with all the above modifications. I just wrote it last night so I haven't tested it extensively. Let me know if you want me to post it.
It's a bit late for me, I fear, since I zipped up almost a gigabyte of old P4 libraries with the old script, but I think you should post your script. Others will surely benefit, and I would certainly make use of it, moving forward. Please post, please do! :)
===========================sigline======================================================
Cage can be an opinionated jerk who posts without thinking. He apologizes for this. He's honestly not trying to be a turkeyhead.
Cage had some freebies, compatible with Poser 11 and below. His Python scripts were saved at archive.org, along with the rest of the Morphography site, where they were hosted.
I compressed a couple gig and it seems to work fine in windows.
Mac users should test it first (could someone check my logic for the Mac OS).
===========================sigline======================================================
Cage can be an opinionated jerk who posts without thinking. He apologizes for this. He's honestly not trying to be a turkeyhead.
Cage had some freebies, compatible with Poser 11 and below. His Python scripts were saved at archive.org, along with the rest of the Morphography site, where they were hosted.
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
Is there a problem with the way this script compresses files? I just used it on all of my old P4 libraries. The newly compressed files cannot be decompressed/unzipped with Aladdin Expander or WinZip. Compressed files saved normally out of P5 do not have this problem. Does anyone know of any kind of solution? Is there a replacement script anywhere which may not have this problem, or can anyone suggest how I might edit the Python script to fix it? I am completely ignorant of the methods and ideas used in the compression process, so I'm not even really sure what I'm asking.... But I'd be willing to try, with a few pointers..... The "bad" compressed files will open in WinZip and the contents could be viewed properly, but the file could not be unzipped. I am wondering whether there might be some king of file "header" or somthing that is not being written properly? I do not know such things....
===========================sigline======================================================
Cage can be an opinionated jerk who posts without thinking. He apologizes for this. He's honestly not trying to be a turkeyhead.
Cage had some freebies, compatible with Poser 11 and below. His Python scripts were saved at archive.org, along with the rest of the Morphography site, where they were hosted.