Unwanted code caching on Python w/ Rhino for Mac


#1

Hi all,
I’m doing some python scripting with Rhino for Mac (on OSX 10.7) using Sublime as my external editor. Something that has been plaguing me is that it seems that every so often, Rhino will stop looking at my actual, newly saved code, and rely instead on a cached version. I’ve learned that if I reboot Rhino, it will snap out of it, but in the meantime I’ve had a couple of unpleasant bouts of “whaddaya mean the module doesn’t have newFunction(whatever), it’s right-frickin’-there!” before remembering to reboot. Rebooting every time I want to test new code is unpleasant, and modifying a print statement to print some new thing each time is 1) tedious and 2) doesn’t always work because for whatever reason, Rhino doesn’t show me my command line output until/unless the script successfully finishes. (Is there any advice on that latter issue, by the way?)

My theory is that there’s some bytecode somewhere that’s getting saved, but I can’t seem to find it. I tried stringing

import sys
sys.dont_write_bytecode = True

around the tops of my files like a garland of magic eyes, but it doesn’t seem to help. Is there some set of files I can periodically nuke, or a setting somewhere I can change? Thanks for any advice you’ve got!


#2

He Lealbaugh,
maybe it’s the same problem I’ve ran into few weeks ago.
Check this post: Python script doesn’t take into account changes during execution

Hope it helps,
Tomas


#3

Aha! Yes, that sounds like it will do the trick, and it only failing to reload imports explains why it felt so random. Thanks, Tomas!