in the dev mode of ghpython, the sys
library doesn’t seem to work properly unless recompile (press “test” button)
see below
the regular procedural mode seems to work ok
any ideas? is this an expected behavior? what’s my option around it?
Sorry I don’t know right now, could you post the definition to repeat?
What happens if you write “import sys” inside the RunScript
method?
Thanks,
Giulio
–
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com
Thanks for the suggestion. It did not work. However when I restarted Rhino and re-wrote that example script in my OP, it worked. I thought reboot solved it but I opened up my more complex script, which is simply too gigantic to post here, the same problem persisted. I even searched through my script and looked for potential variable names I might have declared as “sys” but that was also not the case…
My way around it is in the __init__()
method of MyComponent(component)
, adding self.sys = sys
and calling self.sys
thereafter.
UPDATE:
Strangely enough, I used the following line in the import
section of the code and it runs so smoothly…
from sys import exc_info as errinfo
# some code....
# ...
line_of_err = errinfo()[2].tb_lineno
# that just runs...
Then I don’t know, sorry. Then it really must be something happening deep inside IronPython. If this works, then let’s not change it . The sys
module it somehow special I think.