Skip to content
This repository has been archived by the owner on Jan 6, 2021. It is now read-only.

Make __main__ importable #64

Closed
piac opened this issue Mar 12, 2014 · 2 comments
Closed

Make __main__ importable #64

piac opened this issue Mar 12, 2014 · 2 comments
Labels

Comments

@piac
Copy link
Member

piac commented Mar 12, 2014

http://www.grasshopper3d.com/forum/topics/performance-profiling-in-ghpython

From a quick check, it seems that the solution is outlined in answer 1:
http://stackoverflow.com/questions/8264596/how-do-i-set-name-to-main-when-using-ironpython-hosted

@piac piac added the bug label Mar 12, 2014
@saeranv
Copy link

saeranv commented May 2, 2016

Hello, I know it's been two years, but has this been addressed? I would like to use the timeit.timeit method and I'm running into the same namespace error the parent had: I cannot import methods from main. Is there a way to achieve this?

@piac
Copy link
Member Author

piac commented May 2, 2016

Hi @saeranv, I had actually looked at this and our is a different case.

The 'real' reason is that there is no main. And there is no main because in GhPython there is no file: you can imagine it as code were run from the 'exec' function.

However, this is usually a minor problem. We can work around this (now; I think earlier the version of timeit was not supporting IronPython).

I uploaded a sample at the address: http://www.grasshopper3d.com/xn/detail/2985220:Comment:1520589

I will close this bug item, as there is no way to import this as a nameless module (it's like the interactive interpreter).

@piac piac closed this as completed May 2, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants