|
A problem about python script reloading(Bug or NOT)
|
Reply to this subject
Start a new subject
 
Refresh page
Pages: 1
2
| Posted by |
Nick Gammon
Australia (18,770 posts) bio
Forum Administrator |
| Date |
Reply #15 on Thu 20 Nov 2008 07:36 PM (UTC) [ quote
] |
| Message |
The "reload script file" menu item does exactly what it advertises - it reloads the script file.
To completely re-initialize the script engine you could turn scripting off, then turn it back on again.
However I found a similar problem with Lua, and with an extra line (similar to what Worstje suggested) it forced the module to be reloaded.
In case anyone is wondering, the Lua code is:
package.loaded.my_module = nil -- force reload
require "my_module"
For Python, if you can't find something similar, doesn't reloading the plugin work? That should give you a fresh copy. Failing that, delete the plugin and reinstall it. That would certainly reinitialize the script engine. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
| Posted by |
Poromenos
Greece (1,037 posts) bio
|
| Date |
Reply #16 on Thu 20 Nov 2008 07:37 PM (UTC) [ quote
] |
| Message |
| Ah, it's not a plugin, it's a script :/ Is there an easy way to do this? I'm writing my dissertation in MC and I wouldn't want to turn scripting off and on every time I change a few lines of code, while the automatic reload on save would be pretty handy... |
Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it! | top |
|
| Posted by |
Worstje
Netherlands (867 posts) bio
|
| Date |
Reply #17 on Thu 20 Nov 2008 07:40 PM (UTC) [ quote
] |
| Message |
| Nick, unloading and loading again (not reinstalling) doesn't make a difference if I recall properly, although it's been ages since I tested. :( In essence, something hangs around in memory that says which modules have been loaded, and it won't re-read them. Somehow I suspect that the WSH-bindings (pywin32) are what make the sys.modules trick not work. But I'd need to do some serious testing to be sure. | top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
6,909 views.
This is page 2, subject is 2 pages long:
1
2
Reply to this subject
Start a new subject
 
Refresh page
top
Comments to:
Gammon Software support
Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )