Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Bug reports ➜ A problem about python script reloading(Bug or NOT)

A problem about python script reloading(Bug or NOT)

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1  2 

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #15 on Thu 20 Nov 2008 07:36 PM (UTC)
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)
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  (899 posts)  Bio
Date Reply #17 on Thu 20 Nov 2008 07:40 PM (UTC)
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.


57,470 views.

This is page 2, subject is 2 pages long:  [Previous page]  1  2 

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.