Code

Opened 6 years ago

Closed 16 months ago

#9026 closed Bug (wontfix)

Scripts receive invalid keyboard input under Windows with JVM

Reported by: ikelly 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?

Attachments (0)

Change History (13)

comment:1 Changed 6 years ago by julien

  • 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 follow-up: Changed 6 years ago by 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.)

comment:3 Changed 6 years ago by ikelly

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 6 years ago by julien

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 6 years ago by julien

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

comment:6 Changed 6 years ago by ikelly

  • Summary changed from createsuperuser receives invalid input under Windows to createsuperuser 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 6 years ago by ikelly

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 6 years ago by kmtracey

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 6 years ago by julien

  • Component changed from Authentication to django-admin.py
  • Summary changed from createsuperuser receives invalid input under Windows with JVM to Scripts 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 5 years ago by jacob

  • Triage Stage changed from Unreviewed to Design decision needed

comment:11 Changed 3 years ago by lukeplant

  • Severity set to Normal
  • Type set to Bug

comment:12 Changed 3 years ago by aaugustin

  • 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 16 months ago by aaugustin

  • Resolution set to wontfix
  • Status changed from new to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.