Spyder - UMD has deleted: module

廉价感情. 提交于 2019-12-03 16:11:04

问题


I have been fooling around for about a month with python now and something is bothering me. I use the python(x,y) toolkit, which comes with the neat Spyder IDE. My question concerns the UMD (User module deleter) of Spyder.

I found this graphics module on the internet, which helps one to do some simple graphic stuff in a python script (as far as I understand).

It is not like i'm stuck, but when I execute the folowing code:

import pylab as p
import graphics as g

window = g.GraphWin("tryout", 600, 600)
window.close()
print p.sqrt(4)

The output is:

>>>runfile(r'C:\some\folders\tryout.py', wdir=r'C:\some\folders')
>>>UMD has deleted: graphics
>>>2.0

line 1 is obviously o.k. and so is line 3, but I don't get line 2. Also, the provoked window flashes in and out of the screen, as it should. Line 2 doesn't seem to do any harm, and i can perfectly rerun the file as many times as I wan't, but I want to know where it is comming from.

AFAIK UMD forces the interpreter to reload a module everytime a script is run. Does the displayed message mean that 'it' has deleted the references to the module, because it isn't used anymore, or is it something else? Or does it mean something is wrong, and will it 'hurt' my code should I add more afterwards?

Note: first question, so please comment the crap out of it to help me improve my asking skills.

EDIT: i tried shifting around the test line print p.sqrt(4), and found out that it doesn't matter where I put it. If its the first line after importing the modules, it still raisses the message before showing sqrt(4)


回答1:


Short Answer:

Perhaps deleted is not the best word in the message you mention. It should be reloaded, which is what UMD is really doing and because is way less confusing. I'll fill an issue for this in our issue tracker.

Long answer:

UMD reloads not only your script but also all the local modules it depends on. By local I mean modules outside your Python installation and over which you have writing permissions.

The idea is that next to your script, perhaps you have developed a library of auxiliary functions to go with it. So you most probably want to reload that library too, so that any changes to it are reflected at run time.

I know this is not your case, so if you want to remove that message, you can go to:

Tools > Preferences > Console > Advanced settings > User Module Deleter

and deactivate the option

Show reloaded modules list



来源:https://stackoverflow.com/questions/13876306/spyder-umd-has-deleted-module

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!