Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > getpass and IDEs

Reply
Thread Tools

getpass and IDEs

 
 
Andrew
Guest
Posts: n/a
 
      02-25-2011
I find that calling getpass produces a warning noting that it can't
suppress output, if I'm using idle, wingide, or a few others. If I'm
running from the console it works fine, but then I can't make use of
ide-integrated debugging.

I know I could just set up a test account for development purposes if
I'm concerned about shoulder surfers, and that's probably a good idea
anyway. But I'm curious what's different about IDE environments that
makes it impossible to suppress output on them, and if there's anything
that might be done about this.

--

Andrew
 
Reply With Quote
 
 
 
 
Wolfgang Rohdewald
Guest
Posts: n/a
 
      02-25-2011
On Freitag 25 Februar 2011, Andrew wrote:
> I find that calling getpass produces a warning noting that it
> can't suppress output, if I'm using idle, wingide, or a few
> others. If I'm running from the console it works fine, but
> then I can't make use of ide-integrated debugging.
>
> I know I could just set up a test account for development
> purposes if I'm concerned about shoulder surfers, and that's
> probably a good idea anyway. But I'm curious what's different
> about IDE environments that makes it impossible to suppress
> output on them, and if there's anything that might be done
> about this.


I'd say your IDE redirects stdout/stderr so it can show
output within the IDE

http://docs.python.org/library/getpass.html
reading python docs lets me believe you are using
python pre 2.6

if so, you could try to open a stream to /dev/tty and pass
that to getpass.getpass()

--
Wolfgang
 
Reply With Quote
 
 
 
 
Andrew
Guest
Posts: n/a
 
      02-25-2011
On Fri, 25 Feb 2011 20:27:42 +0100, Wolfgang Rohdewald wrote:

> On Freitag 25 Februar 2011, Andrew wrote:


>> But I'm curious what's different
>> about IDE environments that makes it impossible to suppress
>> output on them, and if there's anything that might be done
>> about this.

>
> I'd say your IDE redirects stdout/stderr so it can show
> output within the IDE
>
> http://docs.python.org/library/getpass.html
> reading python docs lets me believe you are using
> python pre 2.6


3.2. Though maybe you're right anyway. Does IDLE redirect in that
fashion? Why would that interfere with getpass?

I'm less concerned about how to get around it as with figuring out why
it does it. More curiosity than practicality.

--

Andrew
 
Reply With Quote
 
Nobody
Guest
Posts: n/a
 
      02-26-2011
On Fri, 25 Feb 2011 11:50:35 -0500, Andrew wrote:

> I find that calling getpass produces a warning noting that it can't
> suppress output, if I'm using idle, wingide, or a few others. If I'm
> running from the console it works fine, but then I can't make use of
> ide-integrated debugging.
>
> I know I could just set up a test account for development purposes if
> I'm concerned about shoulder surfers, and that's probably a good idea
> anyway. But I'm curious what's different about IDE environments that
> makes it impossible to suppress output on them, and if there's anything
> that might be done about this.


This suggests that the Python interpreter isn't getting a controlling
terminal when spawned from the IDE.

If I run IDLE from a shell, IDLE inherits the shell's controlling
terminal, which the interpreter inherits from IDLE. So getpass() works
correctly, but it uses the original terminal not the IDLE window. If IDLE
is spawned from a desktop environment, there probably won't be any
controlling terminal.

The odd thing is that the Python interpreter spawned from IDLE inherits
its (real) std{in,out,err} from IDLE. If IDLE was started from a terminal,
the interpreter will have that its standard descriptors associated with
the terminal. But the Python sys.std{in,out,err} objects are of
type idlelib.rpc.RPCProxy. This means that anything written via
e.g. "print" or "sys.stdout.write()" will be sent to IDLE, while
e.g. os.write() or child process will use the inherited descriptors.

This behaviour isn't inevitable; it's just the way IDLE works. If an IDE
allocates a pty for the interpreter, and the IDE doesn't already have a
controlling terminal, the pty will become the controlling terminal unless
it explicitly prevents this (by openeing it with the O_NOCTTY flag).

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
getpass Yang Zhang Ruby 7 04-13-2008 08:19 PM
C++ editors and IDEs Mohitz C++ 1 06-28-2007 10:49 AM
How to fool getpass() marekdec@gmail.com C Programming 2 08-15-2006 03:27 PM
why does getpass() show the input? John Salerno Python 6 08-10-2006 02:12 PM
getpass Lucas Raab Python 1 10-12-2003 02:22 AM



Advertisments