Analyse Weight of Object

Hi,
I type in Rhino the command “RunPythonScript” and then select the script f9464ed4c1300f5b.py

ok… that sounds right except there’s no script in this thread called f9464ed4c1300f5b.py…

in the thread, there’s MetalWeight2.py and WeightFromDensity.py

have you downloaded one of those and placed it in the scripts folder? if so, they should be available as a choice upon using RunPythonScript.

you’re running a different script and it’s causing the error… i’m not sure why it’s causing the error as don’t know what’s in it but the point is-- the error you’re getting isn’t being caused by the .py files which were shared in this thread.



hmm… yeah, this might be out of my league because i don’t know why this is happening:

if i search my computer for f9464ed4c1300f5b.py, it points to MetalWeight2.py
?

that said, the script runs fine for me.

When I download the MetalWeight2.py I get a file called “f9464ed4c1300f5b.py” and copy this file to the Scripts folder.
I try to change the name of f9464ed4c1300f5b.py to MetalWeight2.py. But same error…

yeah, i’m not sure why that’s happening nor do i know if the contents of the script are being altered when it happens… someone with more expertise is going to have to figure this one out :wink:

apparently (as seen in my screenshot above) the filename f9464ed4c1300f5b.py is somehow associated with the MetalWeight2 script but i have no idea why the name is being changed on your system upon downloading the file.


it’s the weekend and steve is a busy guy anyway but he might know what’s going on here…
@stevebaer – do you have any ideas what the problem is in the 5 or so posts preceding this one?

@jeff_hammond Might this be a weird interaction of Safari and Discourse? Here on Windows and FF, downloads/filenames are fine… Can you try with a different browser?

–Mitch

oh… it works fine for me with Safari… it’s duke that’s having the issue.

@duke… what browser are you using? and at mitch’s suggestion, can you try downloading the file with a different browser to see if the same thing is happening?

with right click and “save as” it save a file with this name: f9464ed4c1300f5b.py
with direct click the downloaded file is: MetalWeight2.py
but I have the same error…

are you using the latest mac rhino WIP? (or, at least a version which comes with python pre-installed?)

if i’m correctly interpreting the error, it appears this is where it’s failing:

in utility.py line 7, it’s importing a module ‘string’ which appears to be needed in the script but is missing on your system. ?

but i don’t know what the string module is anyway so still not much help? :confused:

mitch will probably know what this thing is ( @Helvetosaur )

Hmm, that’s odd, I don’t see the same script when I download MetalWeight2.py from this thread… I see this (Windows):

oh. that screenshot of mine is from utility.py inside the iron python lib.

I assume something in the script (metal weight ) is using something in utility.py… but it breaks before it gets to it since there’s no module ‘string’
?

(I haven’t even looked at the metal script. on a phone now. can’t check)

I downloaded it with Firefox and it’s working fine. But I didn’t know Python came with Rhino for mac so I downloaded and installed it first. No sure if it makes a difference.

I’m using the script from Pascal, works fine!

There’s lots of stuff in utility.py that rhinoscriptsyntax can call. My utility.py on Windows also imports the string module - which does exist, btw, but normally you don’t need to import it, it’s already loaded… I don’t think that’s the problem…

The script appears to work here on Windows, except that it fails with an extrusion object - looks like a bug there with rs.IsObjectSolid(), returns False with a closed extrusion… Need to test more.

–Mitch

I was just basing it off his error message and the traceback which says there’s no string module.
that message box is pretty much the only debugging help we get on Mac and while it can be confusing to me at times, it’s usually accurate. (but then again, you know how long I’ve been messing with Python so take it fwiw :wink: )

Yes I have the last WIP with python on OS X 10.8.5

find something here: Python issue new install & macrhi file
try tomorrow with upgrading OS X Python: http://wolfpaulus.com/jounal/mac/installing_python_osx/

nice find… that looks like the problem. I suppose you could also upgrade OS X which should include the required Python but maybe you have reasons for staying at 10.8?

The ‘no module named string’ error is a sign that the python plug-in for Mac Rhino is having difficulty locating the python standard library on that computer. I probably didn’t test with 10.8 and need to tweak the search algorithm for that version of the OS

great. thanks for looking into it.

It always fails with an extrusion, I have always exploded and then rejoined if I need to do an extrusion analysis.

@duke, my wife was having this problem on her iMac & Rhino back in October - Exception Occurred. See this thread.

I reinstalled Python on the Mac following this sites instructions;
http://wolfpaulus.com/jounal/mac/installing_python_osx/
and it has worked fine ever since. Seems the issue is with Pytjom on the mac side, not with Rhino.

IHTHelps … Randy

Thanks @rhinorudi I have seen your post. I installed python 3.4.2 but I have no experience with script so I prefer to wait a response from @stevebaer.