pyRevit icon indicating copy to clipboard operation
pyRevit copied to clipboard

Implement Refreshing CPython engine

Open Nicolasbougon opened this issue 6 years ago • 7 comments

Hello, When creating a script with! # Python3, the button only works once. I have to restart revit for it to work again. Is there a solution?

Nicolasbougon avatar Sep 23 '20 17:09 Nicolasbougon

What happens when you click on the button the second time? What's the script?

eirannejad avatar Sep 23 '20 17:09 eirannejad

The modules of the script.py are .pyd files. During the second click nothing happens.

ex

The script file calls the "main" file. The "main" file calls "OK" (print ("ok")), "BONSOIR" (print ("good evening")), "HELLO" (print ("hello")).

Nicolasbougon avatar Sep 23 '20 19:09 Nicolasbougon

Those modules are only imported once on the first run. So if the print statement is inside the modules it's going to be printed only once

eirannejad avatar Sep 23 '20 21:09 eirannejad

Is there a way to re-import them manually in order to rerun?

Nicolasbougon avatar Sep 24 '20 06:09 Nicolasbougon

Try CTRL+SHIFT+ALT and click on the tool. This will discard the existing engine and will use a new engine. Need to test this more with the cpython as it works very different from the IronPython

eirannejad avatar Sep 24 '20 17:09 eirannejad

I had already tested this manipulation but it does not work. I have an error message then REVIT does not respond.

Capture

Thanks anyway.

Nicolasbougon avatar Sep 24 '20 19:09 Nicolasbougon

Hey, @eirannejad is there an ETA for this? How can I help? If you point the way I can spend some time on this as well. I am looking forward to have CPython, ---NEED FOR SPEED --- 🚀

lukemoreira avatar Aug 18 '21 18:08 lukemoreira