Cannot use random in python(atom) in rhino 5 mac

when I run a script from Windows with import random and use random functions, it failed. any ideas?

Hi can you give more details of what you are doing and what error messages you get?
Are you running in the Rhino Script editor with _EditPythonScript ?
The following works for me on Rhino 5 for pc:

import random
print random.randint(1,42)

xkcd has a workaround if you need it :wink:

1 Like

I can run the script above in Rhino 5 for mac.
Yes more details would be useful

thank you for your reply!
I run the same script in Mac rhino 5, it failed.


I cannot open edit python script, but I can use atom.
if I delete “import random”, it works.

Ahh I don’t know about that. Have you done anything with your python installation outside of Rhino? Anything in your site packages folder that could be interferring with random, with the sys or os module or with hashlib ?
Any changes to your atom setup, e.g. the character encoding?

Thank you very much! as you mentioned the hashlib, I found these articles as others met. I copy the module from rhino 6 in windows to Mac. It works!


@herocaripod, what version of Rhino are you running?

rhino for Mac 5.0.1 (5A858)

That explains it. The problem you’re experiencing was fixed in 5.1.

Thank you! I will upgrade it.