New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn on "Frames" option for IronPython scripts #148

Open
bengolder opened this Issue Jul 2, 2013 · 2 comments

Comments

Projects
None yet
2 participants
@bengolder

bengolder commented Jul 2, 2013

cross posted here.

Using GhPython, I recently tried to import a python package that I've used before, networkx, and I get this error:

Runtime error (MissingMemberException): 'module' object has no attribute '_getframe'

A little bit of searching leads me to this example showing that the ability of a script to access its "frame" can be switched on or off by properties that are passed to the IronPython Engine upon instantiation:

var options = new Dictionary<string, object>(); 
options["Frames"] = true; 
options["FullFrames"] = true; 
ScriptEngine engine = Python.CreateEngine(options);

This seems like a harmless and helpful change to the RhinoPython implementation, which would allow a greater use of third-party python packages. Is there any possibility of changing the current implementation?

@bengolder

This comment has been minimized.

Show comment
Hide comment
@bengolder

bengolder Jul 2, 2013

I've used networkx with RhinoPython before, so this was not previously a problem.

I tested with multiple previous versions of networkx. All give the same error. Therefore this _getframe error seems to be caused by a change in the Rhino IronPython implementation.

bengolder commented Jul 2, 2013

I've used networkx with RhinoPython before, so this was not previously a problem.

I tested with multiple previous versions of networkx. All give the same error. Therefore this _getframe error seems to be caused by a change in the Rhino IronPython implementation.

@sbaer

This comment has been minimized.

Show comment
Hide comment
@sbaer

sbaer Jul 11, 2013

Member

This actually slows down script execution and I need to figure out a good way to allow this option in the rare cases that ghPython scripts would need them.

There is an option in the python script editor "EditPythonScript" options dialog that allows for turning frames on. This should globally affect the entire python system in Rhino and will probably turn frames of for ghPython scripts. Not very obvious, but the option is there.

Member

sbaer commented Jul 11, 2013

This actually slows down script execution and I need to figure out a good way to allow this option in the rare cases that ghPython scripts would need them.

There is an option in the python script editor "EditPythonScript" options dialog that allows for turning frames on. This should globally affect the entire python system in Rhino and will probably turn frames of for ghPython scripts. Not very obvious, but the option is there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment