[issue13543] shlex with string ending in space gives ValueError: No closing quotation

2011-12-09 Thread ekorn

ekorn jono...@gmail.com added the comment:

https://github.com/ipython/ipython/issues/1109#issuecomment-3072571
It seems this was an IPython bug due to slight abuse of the shlex module. 
Closing as invalid; thanks for your help.

--
resolution:  - invalid
status: open - closed

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



[issue13543] shlex with string ending in space gives ValueError: No closing quotation

2011-12-08 Thread ekorn

ekorn jono...@gmail.com added the comment:

FYI, Min RK commented on the IPython issue:
https://github.com/ipython/ipython/issues/1109#issuecomment-3071470

In short, 
shlex.shlex('blob f( )', posix=False)
fails, whereas 
shlex.shlex('blob f(  )', posix=False)

The problem appears to be that Python source obviously doesn't sit well with 
non-posix whitespace-split shlex. [...] if you lead all your open-quotes with 
whitespace, you should be fine (works for all given examples, at least). [...] 
I have no idea whether this is a Python bug or not, since I don't know what the 
reference standard is, but this is definitely an IPython bug.  We should not be 
trying to use shlex to parse Python code as if it were command-line arguments.

--

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



[issue13543] shlex with string ending in space gives ValueError: No closing quotation

2011-12-06 Thread ekorn

New submission from ekorn jono...@gmail.com:

It seems shlex fails on processing strings ending in space, causing this bug 
that I reported for IPython:
https://github.com/ipython/ipython/issues/1109

Fernando Perez made a minimal example of the problem, quoted below. As he 
points out, it would be best to fix this at the source, namely the shlex module.

Python 2.7.2 |EPD 7.1-1 (32-bit)| (default, Jul  3 2011, 15:13:59) [MSC v.1500 
32 bit (Intel)] on win32
 import shlex
 lex = shlex.shlex(' (a )', posix=False)
 lex.whitespace_split = True
 list(lex)
Traceback (most recent call last):
  File stdin, line 1, in module
  File C:\Python27\lib\shlex.py, line 269, in next
token = self.get_token()
  File C:\Python27\lib\shlex.py, line 96, in get_token
raw = self.read_token()
  File C:\Python27\lib\shlex.py, line 172, in read_token
raise ValueError, No closing quotation
ValueError: No closing quotation

--
components: Library (Lib)
messages: 148941
nosy: ekorn
priority: normal
severity: normal
status: open
title: shlex with string ending in space gives ValueError: No closing 
quotation
type: behavior
versions: Python 2.7

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



[issue12148] Clarify or-ing together doctest option flags

2011-05-22 Thread ekorn

New submission from ekorn jono...@gmail.com:

Combining multiple option flags to doctest.testmod(optionflags=...) requires 
the bitwise or operator |, not plain or. I therefore suggest rewording 
or-ing together individual option flags. to or-ing together individual 
option flags, using the 'bitwise or' operator |., perhaps with a link to 
http://docs.python.org/reference/expressions.html#binary-bitwise-operations.

Example:


Doctest option flags must be or-ed together with '|', not 'or'.

 print A  B  C
A B...

import doctest

print Combining option flags using bitwise '|'...
doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS)
print Combining option flags using logical 'or'...
doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE or doctest.ELLIPSIS)

--
assignee: docs@python
components: Documentation
messages: 136509
nosy: docs@python, ekorn
priority: normal
severity: normal
status: open
title: Clarify or-ing together doctest option flags
versions: Python 2.7

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



[issue4545] doctest seems to always fail on numpy.array2string

2008-12-05 Thread ekorn

New submission from ekorn [EMAIL PROTECTED]:

I don't understand this doctest error, resulting from
python test_doctest.py

Failed example:
numpy.array2string(numpy.arange(2))
Expected:
[0 1]
Got:
'[0 1]'

The specified output was copied-and-pasted directly from running the 
example. Whitespace seems identical and #doctest: +NORMALIZE_WHITESPACE 
does not help.

--
components: Tests
files: test_doctest.py
messages: 77006
nosy: ekorn
severity: normal
status: open
title: doctest seems to always fail on numpy.array2string
type: behavior
versions: Python 2.5
Added file: http://bugs.python.org/file12237/test_doctest.py

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4545
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com