Pydev debugger: unable to find module to reload

I wrote a python module in Eclipse and named it main.py

Code:

if __name__ == "__main__":  
    inFile = open ("input.txt", 'r')
    inputData = inFile.readlines()

    print 'all done :)'

      

Well, it works, but every time I save the project, I get this error in the console:

pydev debugger: Unable to find module to reload: "main".

      

Any idea what this means?

+3


source to share


3 answers


pydev debugger: unable to find module to reload:

There, the message does not indicate a problem with your program. This means that you saved the original file in Eclipse and pydev was trying to reload the new code. The message is generated by pysrc / pydevd.py in the processNetCommand () method when the CMD_RELOAD_CODE (from Elcipse?) Command is received. This "reload" command looks for your module (named "main" in your question) in the sys.modules list. This list maps the module name to the module object (which includes the filename to reload the module)

Since "main" was not found in the sys.modules dictionary, it issues this message. If it found "main" in sys.modules, it would pass sys.modules ['main'], which should be a, to xreload () from the pydevd_reload module. I think it has to do with the way pydev loads your module into the Eclipse / python debug environment.



As a result, updates to your Python code are not reflected in the debugger. And you have to end your debug session and start it again from the top - which is common to debug when the source code changes.

I have been playing around with adding my module to sys.modules so that it can find the module to reload. It is neat that you can do this, but usually not very practical.

+3


source


I am new to Python too, but as far as I understand, the main () module cannot be reloaded. I believe this is not a real bug or something to worry about.



0


source


Go to Preferences -> PyDev -> Interactive Console, uncheck or uncheck "Connect console to debug session?"

0


source







All Articles