Thu, Nov 28, 5:36 PM CST

Renderosity Forums / Poser Python Scripting



Welcome to the Poser Python Scripting Forum

Forum Moderators: Staff

Poser Python Scripting F.A.Q (Last Updated: 2024 Sep 18 2:50 am)

We now have a ProPack Section in the Poser FreeStuff.
Check out the new Poser Python Wish List thread. If you have an idea for a script, jot it down and maybe someone can write it. If you're looking to write a script, check out this thread for useful suggestions.

Also, check out the official Python site for interpreters, sample code, applications, cool links and debuggers. This is THE central site for Python.

You can now attach text files to your posts to pass around scripts. Just attach the script as a txt file like you would a jpg or gif. Since the forum will use a random name for the file in the link, you should give instructions on what the file name should be and where to install it. Its a good idea to usually put that info right in the script file as well.

Checkout the Renderosity MarketPlace - Your source for digital art content!



Subject: Problem with Poser 5 Compress Files Script


Cage ( ) posted Tue, 15 February 2005 at 12:54 AM · edited Thu, 01 August 2024 at 7:17 PM

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.


ockham ( ) posted Tue, 15 February 2005 at 9:35 PM

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


Cage ( ) posted Wed, 16 February 2005 at 12:59 AM

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.


tromnek ( ) posted Fri, 04 March 2005 at 10:23 AM

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.


Cage ( ) posted Sat, 05 March 2005 at 1:59 AM

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.


tromnek ( ) posted Sun, 06 March 2005 at 10:26 PM

file_185045.jpg

Here's a modified version. Read the top of the script for details. The changes are basically; Made it able to run in both Poser and native Python. Make sure the drive letter and colon are not stored in the gzip header. Store the original file extension in the gzip header. Made file extension checks more stringent. Extra sanity check before deleting original file. Made path stored in gzip header begin at the first 'Runtime' encountered in path spec. You can change this easily at the bottom of the script.

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).


tromnek ( ) posted Mon, 07 March 2005 at 9:16 PM

file_185046.jpg

Forgot to check for end of string. Here's a new version.


Cage ( ) posted Wed, 09 March 2005 at 2:16 PM

file_185050.jpg

I have adapted tromnek's script to be able to run the uncompress script from native Python, as well. This is the default P5 script, with a couple of tromnek's lines pasted in by me.

===========================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.


Privacy Notice

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.