Opened 8 years ago

Closed 4 years ago

#9026 closed Bug (wontfix)

Scripts receive invalid keyboard input under Windows with JVM

Reported by: Ian Kelly Owned by: nobody
Component: Core (Management commands) Version: 1.0
Severity: Normal Keywords:
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In trunk and 1.0 on Windows, the createsuperuser command fails to recognize input as valid, because every line of input is terminated with '\r', which the command is not expecting. syncdb causes a similar problem when it presents the createsuperuser question loop, where the only way out is Ctrl-C.

In a regular Python or IPython shell running on Windows, the result of raw_input() isn't terminated with whitespace at all. Are we doing something weird with stdin in the management commands?

Change History (13)

comment:1 Changed 8 years ago by Julien Phalip

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

There are in fact many related issues. When run in Eclipse for Windows all Django scripts (syndb, shell, etc.) fail to validate input. A similar issue was raised in #8284 but was closed as wontfix. I think something should be done here. The problem seems to lie within Django, or at least within an incompatibility between Django and Windows.

See also: http://groups.google.com/group/django-users/browse_thread/thread/4df9082fb57e7782/2250f5c70c1c2acf?lnk=gst&q=eclipse+input#2250f5c70c1c2acf

comment:2 Changed 8 years ago by Karen Tracey

Yes, there are problems with script input running under Eclipse on Windows but the original report says nothing about Eclipse. Is Eclipse involved there or no? (I do not have any problems with these scripts running on Windows and using a plain Windows command prompt.)

comment:3 Changed 8 years ago by Ian Kelly

I was using a regular Windows cmd shell, not Eclipse. I'll try the Ctrl-Enter solution from the other ticket in the morning, but I suspect that's just an Eclipse thing.

comment:4 in reply to:  2 Changed 8 years ago by Julien Phalip

Replying to kmtracey:

Yes, there are problems with script input running under Eclipse on Windows but the original report says nothing about Eclipse. Is Eclipse involved there or no? (I do not have any problems with these scripts running on Windows and using a plain Windows command prompt.)

I was just mentioning about Eclipse to provide some extra information, as I suspect these issues may all be linked. I haven't been able to test Eclipse under Mac to narrow down and be sure it's a Windows-specific problem.

Input in Python scripts running in Eclipse, other than with Django, always work for me. So I assume there's something wrong in the way Django handles that. But I'm no expert to see how to fix or go around that.

comment:5 Changed 8 years ago by Julien Phalip

Also, like Karen, I've never had trouble with scripts run with the plain Windows command shell.

comment:6 Changed 8 years ago by Ian Kelly

Summary: createsuperuser receives invalid input under Windowscreatesuperuser receives invalid input under Windows with JVM

Further experimentation shows that the problem is actually caused by the arcane mixture of Django, Windows, and Java. I'm using JPype in my app to gain access to some Java libraries, and the problem only occurs when a JVM has been started. It also does not occur in Linux, and it does not occur outside of a Django environment. This is almost certainly the same issue as in #8284, and it's obscure enough that it should probably be wontfixed as well.

comment:7 Changed 8 years ago by Ian Kelly

One additional prerequisite: the problem occurs with a Java 1.6 JVM, but it seems to be fine with a Java 1.5 JVM.

comment:8 Changed 8 years ago by Karen Tracey

Actually just the fact that you've found another case where this happens (even if it is arcane) makes me think it might be more worth fixing than when it was isolated to running under Eclipse. Stripping carriage returns really shouldn't be necessary, but it doesn't seem like it would be harmful, and if there are multiple environments where users could encounter this I'd tend to think we should just go ahead and fix it within Django. For the poor novice user who does encounter it it can be quite befuddling.

comment:9 Changed 8 years ago by Julien Phalip

Component: Authenticationdjango-admin.py
Summary: createsuperuser receives invalid input under Windows with JVMScripts receive invalid keyboard input under Windows with JVM

Just changing the summary as the problem is for every script. I tested with createsuperuser, syncdb, shell, flush and reset.

comment:10 Changed 8 years ago by Jacob

Triage Stage: UnreviewedDesign decision needed

comment:11 Changed 5 years ago by Luke Plant

Severity: Normal
Type: Bug

comment:12 Changed 5 years ago by Aymeric Augustin

Easy pickings: unset
UI/UX: unset

I'm not a big fan of introducing code in Django to work around bugs in third party software, especially software that isn't closely related to Django.

comment:13 Changed 4 years ago by Aymeric Augustin

Resolution: wontfix
Status: newclosed

This bug has been around forever and obviously no one knows what to do about it.

Please provide a patch and a rationale if you want to reopen it.

Note: See TracTickets for help on using tickets.
Back to Top