Home  >  Q&A  >  body text

How to do hot update in Pyd?

Now we have a plug-in update system for the PC client. In the past, the plug-in had the suffix .py. no problem. But recently there is a problem when using cython to compile pyd. When the main program imports the pyd module, it cannot be deleted. Prompt file occupation. It can only be deleted when the main program is closed. But this loses the meaning of hot update. Is there any way to dynamically uninstall pyd or is there a better way?

import xxpyd
import sys

print 'xxpyd' in sys.modules
del sys.modules['xxpyd']
print 'xxpyd' in sys.modules

import time
time.sleep(100)

Even if sys.modules is deleted, pyd cannot be deleted.

仅有的幸福仅有的幸福2685 days ago1305

reply all(3)I'll reply

  • PHP中文网

    PHP中文网2017-06-13 09:26:40

    There is currently a compromise solution, which is to use a plug-in management class to control the import and acquisition of pyd. The advantage is that it can be hot updated as many times as desired. The disadvantage is that all referenced import syntax must be replaced by the plug-in management class to import

    reply
    0
  • 怪我咯

    怪我咯2017-06-13 09:26:40

    If the imported pyd file cannot be deleted, can it be updated with a new pyd file every time, such as 20170616.pyd (just an example). Other old files will be deleted every time the main program is stopped or at other times.

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-06-13 09:26:40

    pyd is essentially dll

    There is a saying called dll hell, which describes how difficult it is to do version management of dlls

    reply
    0
  • Cancelreply