[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Bug reports
. . -> [Subject]  A problem about python script reloading(Bug or NOT)
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

A problem about python script reloading(Bug or NOT)

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Pages: 1  2 

Posted by Nick Gammon   Australia  (19,497 posts)  [Biography] 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
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] 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!
[Go to top] top

Posted by Worstje   Netherlands  (867 posts)  [Biography] 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.
[Go to top] 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.


8,348 views.

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

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Web site powered by FutureQuest.Net]