Input not working in Console (Django)
Brought to you by:
fabioz
Hi,
I'm trying to use the PyDev console but it does not work properly.
When I type a value and press 'enter', the value is never received properly by the shell. I have that issue in every shell script I use.
For example:
>>> a=1
>>> File "<console>", line 1
a=1
^
SyntaxError: invalid syntax
I get that error whatever I type in.
Another example is given in the attached screenshot: the script (the Django 'syncdb' command) asks me to type 'yes' or 'no'. Whatever I type it is not recognized.
I really hope there is a way around that. Please let me know.
I'm using PyDev Extensions 1.3.18 with Aptana.
Thank you,
Julien
Logged In: YES
user_id=617340
Originator: NO
Ok, the problem seems to be that Aptana is based on Eclipse 3.2... So, I've took a look into the code and re-added support for Eclipse 3.2 where that's possible (I think that this support is available for everything but the hyperlinks -- which had an API breakage in Eclipse 3.3 -- so, the go to definition must use F3 in Aptana)
Logged In: YES
user_id=2107094
Originator: YES
Hi, unfortunately the same problem persists with 1.3.19 and Aptana.
Logged In: YES
user_id=617340
Originator: NO
Do you have some error in your error log when starting the console?
Logged In: YES
user_id=2107094
Originator: YES
Aptana doesn't crash or doesn't show any error popup window, but in the log I found all these messages related to pyDev. Not sure if any of those is related to the particular I have in the console:
!ENTRY org.python.pydev 4 4 2008-08-11 22:02:48.343
!MESSAGE org/python/pydev/editor/codecompletion/revisited/PythonPathHelper$1
!STACK 0
java.lang.NoClassDefFoundError: org/python/pydev/editor/codecompletion/revisited/PythonPathHelper$1
at org.python.pydev.editor.codecompletion.revisited.PythonPathHelper.getModulesBelow(PythonPathHelper.java:71)
at org.python.pydev.editor.codecompletion.revisited.PythonPathHelper.getModulesFoundStructure(PythonPathHelper.java:455)
at org.python.pydev.editor.codecompletion.revisited.ModulesManager.changePythonPath(ModulesManager.java:225)
at org.python.pydev.editor.codecompletion.revisited.ProjectModulesManager.changePythonPath(ProjectModulesManager.java:368)
at org.python.pydev.editor.codecompletion.revisited.ASTManager.changePythonPath(ASTManager.java:67)
at org.python.pydev.plugin.nature.PythonNature$RebuildPythonNatureModules.run(PythonNature.java:99)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
!ENTRY org.python.pydev.core 4 4 2008-08-11 22:02:48.375
!MESSAGE Plug-in com.python.pydev.analysis was unable to load class com.python.pydev.analysis.additionalinfo.builders.InterpreterObserver.
!STACK 1
org.eclipse.core.runtime.CoreException: Plug-in com.python.pydev.analysis was unable to load class com.python.pydev.analysis.additionalinfo.builders.InterpreterObserver.
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.throwException(RegistryStrategyOSGI.java:165)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:149)
at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:759)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:51)
at org.python.pydev.core.ExtensionHelper.getParticipants(ExtensionHelper.java:112)
at org.python.pydev.plugin.nature.PythonNature$RebuildPythonNatureModules.run(PythonNature.java:102)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
org.eclipse.core.runtime.CoreException[1]: java.lang.ClassNotFoundException: com.python.pydev.analysis.additionalinfo.builders.InterpreterObserver
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:402)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:347)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:83)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at org.eclipse.osgi.framework.internal.core.BundleLoader.loadClass(BundleLoader.java:278)
at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:227)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1245)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:147)
at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:759)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:51)
at org.python.pydev.core.ExtensionHelper.getParticipants(ExtensionHelper.java:112)
at org.python.pydev.plugin.nature.PythonNature$RebuildPythonNatureModules.run(PythonNature.java:102)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
!SUBENTRY 1 org.eclipse.equinox.registry 4 1 2008-08-11 22:02:48.375
!MESSAGE Plug-in com.python.pydev.analysis was unable to load class com.python.pydev.analysis.additionalinfo.builders.InterpreterObserver.
!STACK 0
java.lang.ClassNotFoundException: com.python.pydev.analysis.additionalinfo.builders.InterpreterObserver
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:402)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:347)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:83)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at org.eclipse.osgi.framework.internal.core.BundleLoader.loadClass(BundleLoader.java:278)
at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:227)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1245)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:147)
at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:759)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:51)
at org.python.pydev.core.ExtensionHelper.getParticipants(ExtensionHelper.java:112)
at org.python.pydev.plugin.nature.PythonNature$RebuildPythonNatureModules.run(PythonNature.java:102)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
!ENTRY org.eclipse.core.jobs 4 2 2008-08-11 22:02:48.375
!MESSAGE An internal error occurred during: "Python Nature: rebuilding modules".
!STACK 0
java.lang.NoClassDefFoundError: org/python/pydev/plugin/nature/PythonNatureListenersManager
at org.python.pydev.plugin.nature.PythonNature$RebuildPythonNatureModules.run(PythonNature.java:117)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
!ENTRY org.eclipse.core.jobs 4 2 2008-08-11 22:02:48.375
!MESSAGE An internal error occurred during: "Python Nature: rebuilding modules".
!STACK 0
java.lang.NoClassDefFoundError: org/python/pydev/plugin/nature/PythonNatureListenersManager
at org.python.pydev.plugin.nature.PythonNature$RebuildPythonNatureModules.run(PythonNature.java:117)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
!ENTRY org.python.pydev 4 4 2008-08-11 22:02:48.500
!MESSAGE org/python/pydev/editor/codecompletion/revisited/PythonPathHelper$1
!STACK 0
java.lang.NoClassDefFoundError: org/python/pydev/editor/codecompletion/revisited/PythonPathHelper$1
at org.python.pydev.editor.codecompletion.revisited.PythonPathHelper.getModulesBelow(PythonPathHelper.java:71)
at org.python.pydev.editor.codecompletion.revisited.PythonPathHelper.getModulesFoundStructure(PythonPathHelper.java:455)
at org.python.pydev.editor.codecompletion.revisited.ModulesManager.changePythonPath(ModulesManager.java:225)
at org.python.pydev.editor.codecompletion.revisited.ProjectModulesManager.changePythonPath(ProjectModulesManager.java:368)
at org.python.pydev.editor.codecompletion.revisited.ASTManager.changePythonPath(ASTManager.java:67)
at org.python.pydev.plugin.nature.PythonNature$RebuildPythonNatureModules.run(PythonNature.java:99)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
!ENTRY org.eclipse.core.jobs 4 2 2008-08-11 22:02:48.500
!MESSAGE An internal error occurred during: "Python Nature: rebuilding modules".
!STACK 0
java.lang.NoClassDefFoundError: org/python/pydev/plugin/nature/PythonNatureListenersManager
at org.python.pydev.plugin.nature.PythonNature$RebuildPythonNatureModules.run(PythonNature.java:117)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
Logged In: YES
user_id=617340
Originator: NO
I've done some fixes, so, if you can check if it works for you... There's a binary release at http://www.fabioz.com/pydev/zips/index.php?sort=date (the zip install labeled 'ALPHA')
Also, it'd be nice if you cleared you error log before installing, so that if some error passes you can easily attach it later (without doubts if that's really it)
Logged In: YES
user_id=2107094
Originator: YES
Hi,
So, I've narrowed it down a bit. The problem only appears when I use a Django script. Many people have got the same issue. Apparently, there's a '\r' character appended whenever the 'Enter' key is pressed, which causes the input to fail.
Please refer to these 2 related links:
http://code.djangoproject.com/ticket/8284
http://mail.python.org/pipermail/python-list/2008-March/482847.html
It would be great if this could be fixed, or at least have a workaround. I tried the ctrl+enter trick, but it doesn't work for me... :(
Thanks!
Logged In: YES
user_id=617340
Originator: NO
I did a simple test with a script:
def Ask():
....response = raw_input('yes or no?')
....if response == 'yes':
........print 'correct'
....else:
........print 'not correct'
Ask()
And it seems to be working for me with the latest release when running that program... It also seems to work when starting the interactive console: http://pydev.sourceforge.net/console.html and making an execfile() for that script...
So, it seems you're using some other way for running your script... can you elaborate a bit on it to explain how's that problem appearing? (note that this really was an issue until 1.3.18, but 1.3.19 should've fixed it -- and that fix is also in the 'ALPHA' release with the zip I mentioned before)
Logged In: YES
user_id=2107094
Originator: YES
I forgot to mention that I tried both with 1.3.19 and ALPHA release.
I confirm that the interactive console works fine. The problem only appears with Django. Yet the Django developers said that it was likely a problem with Eclipse..
Basically, the command that I run is: "manage.py shell"