[issue14174] argparse.REMAINDER fails to parse remainder correctly

2012-10-06 Thread Idan Kamara

Idan Kamara added the comment:

Unfortunately parse_known_args is buggy too: http://bugs.python.org/issue16142

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14174
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16142] ArgumentParser inconsistent with parse_known_args

2012-10-05 Thread Idan Kamara

New submission from Idan Kamara:

When known and unknown options are given together in the same option string 
(e.g. -xy) then ArgumentParser behaves in a strange way:

- if the known option is given first (so -k is known and the parser is fed with 
['-ku']) then the parsing aborts with error: argument -k/--known: ignored 
explicit argument 'u'

- if the unknown option is given first then both options are treated as unknown 
and returned in the list of remaining arguments.

This makes it impossible to use parse_known_args for its intended purpose 
because every single letter option might be interleaved with other unknown 
options.

I attached a test script that demonstrates this.

--
components: Library (Lib)
files: aparse.py
messages: 172088
nosy: idank
priority: normal
severity: normal
status: open
title: ArgumentParser inconsistent with parse_known_args
type: behavior
versions: Python 2.7, Python 3.3
Added file: http://bugs.python.org/file27434/aparse.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16142
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16142] ArgumentParser inconsistent with parse_known_args

2012-10-05 Thread Idan Kamara

Idan Kamara added the comment:

Yes that'd fix the known option before unknown but not the other way around.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16142
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14174] argparse.REMAINDER fails to parse remainder correctly

2012-09-21 Thread Idan Kamara

Idan Kamara added the comment:

I just ran into this issue myself and worked around it by using 
parse_known_args*.

* http://docs.python.org/library/argparse.html#partial-parsing

--
nosy: +idank

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14174
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12833] raw_input misbehaves when readline is imported

2011-08-27 Thread Idan Kamara

Idan Kamara idank...@gmail.com added the comment:

You're right, as this little C program verifies:

#include stdio.h
#include stdlib.h
#include readline/readline.h

int main() {
   printf(foo );
   char* buf = readline();
   free(buf);

   return 0;
}

Passing ' ' seems to be a suitable workaround for those who can't pass the text 
directly to raw_input though (such is the case where you have special classes 
who handle output).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12833
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12833] raw_input misbehaves when readline is imported

2011-08-26 Thread Idan Kamara

Idan Kamara idank...@gmail.com added the comment:

Reproduced on 2.7.

(flushing stdin/out doesn't help)

--
versions: +Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12833
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12833] raw_input misbehaves when readline is imported

2011-08-24 Thread Idan Kamara

New submission from Idan Kamara idank...@gmail.com:

import sys, readline

sys.stdout.write('foo ')
raw_input()

When trying the above on Debian, 2.6.6 using gnome-terminal, typing a character 
then hitting backspace deletes foo  as well.

I'm not sure if this is a bug or the expected behavior when writing to stdout 
directly rather than passing the string to raw_input() (for my particular use 
case that's not an option though).

One possible workaround seems to be to delete the trailing space from write() 
and move it to raw_input:

sys.stdout.write('foo')
raw_input(' ')

Then backspace seems to work properly. This has something to do with readline 
because when it's not imported, it also works as expected (but other things 
break obviously).

--
components: Library (Lib)
messages: 142887
nosy: idank
priority: normal
severity: normal
status: open
title: raw_input misbehaves when readline is imported
type: behavior
versions: Python 2.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12833
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12786] subprocess wait() hangs when stdin is closed

2011-08-20 Thread Idan Kamara

Idan Kamara idank...@gmail.com added the comment:

Thanks for getting on top of this so quickly Charles. Setting close_fds=True 
worked like a charm.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12786
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12786] subprocess wait() hangs when stdin is closed

2011-08-19 Thread Idan Kamara

New submission from Idan Kamara idank...@gmail.com:

The following program hangs on Debian, Python 2.6.6:

import subprocess

proc1 = subprocess.Popen(['cat'], stdin=subprocess.PIPE)
proc2 = subprocess.Popen(['cat'], stdin=subprocess.PIPE)

proc1.stdin.close()
proc1.wait()

Changing the last two lines to:

proc2.stdin.close()
proc2.wait()

Doesn't hang. The guys at #python-dev confirmed the same happens on 2.7 but not 
on 3.x.

--
components: Library (Lib)
messages: 142475
nosy: Idan.Kamara
priority: normal
severity: normal
status: open
title: subprocess wait() hangs when stdin is closed
type: resource usage
versions: Python 2.6, Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12786
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com