I wrote a python module in Eclipse and called it main.py
The code:
if __name__ == "__main__":
inFile = open ("input.txt", 'r')
inputData = inFile.readlines()
print 'all done :)'
Well, it runs, 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 it means?
pydev debugger: Unable to find module to reload:
There message doesn't indicate a problem with your program. It means that you saved a source 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 a CMD_RELOAD_CODE command is received (from Elcipse?). That 'reload' command is looking 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 name of the file to reload the module from)
Because 'main' was not found in the sys.modules dictionary, it issues that message. If it had found 'main' in sys.modules it would have passed sys.modules['main'], which should be a , to xreload() from from pydevd_reload module. I think this has something to do with the way that pydev loads your module in the Eclipse/python debug environment.
The result is that the updates to your python code are not reflected in the debugger. And that you must terminate the debug session and start it again from the top -- which is sort of normal operation for debugging when you change the source code.
I've played with appending my module to sys.modules so that it can find the module to reload. It's neat that you can do that, but generally not of much practical use.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With