Bug report #9894

In python console, input() raises EOFError

Added by pierre krmr about 10 years ago. Updated about 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:PyQGIS Console
Affected QGIS version:2.2.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:end of life
Crashes QGIS or corrupts data:No Copied to github as #:18411

Description

Just type "input()" in the Qgis console :


input()
Traceback (most recent call last):
File "<input>", line 1, in <module>
EOFError: EOF when reading a line

What it should do :


input()
then i type something + enter
'then i type something + enter'

I need it for a script to ask the user for some string data (like Y/N choices, new parameters depending on partial results after a first process step, etc...)


Related issues

Duplicated by QGIS Application - Bug report #9895: In python console, input() raises EOFError Closed 2014-03-26

History

#1 Updated by Jürgen Fischer about 10 years ago

Why not use QInputDialog?

Like this:

>>> from PyQt4.QtGui import QInputDialog
>>> QInputDialog.getText(None, "Parameter", "Enter text")
(u'sdfafa', True)

#2 Updated by Etienne Tourigny about 10 years ago

I guess the bug reporter doesn't want a dialog popping up?

#3 Updated by Etienne Tourigny about 10 years ago

I tried that in qgis-2.2 and it freezes QGIS...

#4 Updated by pierre krmr about 10 years ago

Etienne Tourigny wrote:

I guess the bug reporter doesn't want a dialog popping up?

Indeed.
I use QInputDialog, but I just think it's more functional, fast, aesthetic, to keep his eyes on the console.

Ten years I use autocad, I have never found anything more relevant and productive than that:

CIRCLE
Specify center point for circle or [ 3P/ 2P/ Ttr (tan tan radius)]:
Specify diameter of circle <current>:

This is just an example, not what I want to code, but with only one simple function I can draw a circle with :
- 3 points of the circle
- 2 points of a diameter of the circle
- 2 points on two other circles + radius length
- 2 points (center + one point on the circle)
- 1 point + radius length

Making different functions or adding buttons and windows would ruin everything here.
Yes, it is old-fashioned, but I love it ;-)

#5 Updated by Jürgen Fischer almost 10 years ago

  • Category set to PyQGIS Console

#6 Updated by Giovanni Manghi almost 7 years ago

  • Regression? set to No
  • Easy fix? set to No

#7 Updated by Giovanni Manghi about 5 years ago

  • Resolution set to end of life
  • Status changed from Open to Closed

Also available in: Atom PDF