GoogleCodeArchives / editra

Automatically exported from code.google.com/p/editra
Other
0 stars 0 forks source link

Developing a Python/C module and using it in Python code #344

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Setup: winxp, Editra SVN, python 2.6.1, wx 2.8.9.1

Here's the scenario:
I'm developing a Python/C module (built on MSVC). I have a testsuite in
Python, opened in Editra.
When I use the autocompletion feature my module gets loaded by Editra. Now
suppose the testsuite finds a bug: I go back to C, fix something and
rebuild. Problem is the module DLL/SO is still loaded by Editra and can't
be overwritten by the C linker.
Simply loading/unloading the module every time is likely a performance
killer, but maybe it's the simplest solution and worth a shot.

Original issue reported on code.google.com by cow...@gmail.com on 7 May 2009 at 7:00

GoogleCodeExporter commented 9 years ago
Hello,

There is unfortunately no safe way to do this, when python loads a module it 
loads it
once and it is not reloaded again unless forcefully done so.

I don't think there is a way for me to do this within Editra automatically as 
the
completer currently runs in the same instance of python that Editra is using 
and I
can't have it unload modules after each completion without the chance of 
breaking
Editra during runtime.

Here are some possible solutions to your use case:

1) If you don't have it already download and install Unlocker
(http://ccollomb.free.fr/unlocker/) this is quite invaluable to have on windows 
if
your doing any kind of development. Just right click on the file that Editra 
has the
lock on and unlock it, so you can write over it.

2) You could possibly also manually unload the module yourself by opening the 
PyShell
plugin and deleting your module from sys.modules.

i.e)
import sys
del sys.modules['mymodule']

Cody

Original comment by CodyPrec...@gmail.com on 7 May 2009 at 7:09