Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPython console: "sre_constants.error: unbalanced parenthesis" while typing #2341

Closed
J3ronimo opened this issue Apr 20, 2015 · 11 comments
Closed

Comments

@J3ronimo
Copy link

Description

What steps will reproduce the problem?

In an IPython console in Spyder, write:

from datetime import datetime
now = datetime.now

Now try to enter the following line:

datetime.isoformat(now())

What is the expected output? What do you see instead?
In my case, as soon as I type the second '(', the internal console raises an "sre_constants.error: unbalanced parenthesis".

In a standalone IPython Qt console, this works fine and the arguments list of datetime.now is shown as expected.

Version and main components

  • Spyder Version: 2.3.4
  • Python Version: 3.4.3
  • Qt Version : 4.8.6, PyQt4 (API v2) 4.11.3 on Windows

Optional dependencies

pyflakes >=0.6.0: 0.8.1 (OK)
pep8 >=0.6 : 1.6.2 (OK)
IPython >=1.0 : 3.1.0 (OK)
zmq >=2.1.11 : 14.5.0 (OK)
pygments >=1.6 : 2.0.2 (OK)
pandas >=0.13.1 : 0.16.0 (OK)
sphinx >=0.6.6 : None (NOK)
rope >=0.9.2 : 0.9.4-1 (OK)
jedi >=0.8.1 : None (NOK)
matplotlib >=1.0: 1.4.3 (OK)
sympy >=0.7.3 : 0.7.6 (OK)
pylint >=0.25 : 1.4.3 (OK)

@Nodd
Copy link
Contributor

Nodd commented Apr 20, 2015

Thanks for your report.
Is it the full text printed on the console, there is no traceback with the line numbers and so on ?

@J3ronimo
Copy link
Author

Hi. Here's the full output it gives me:

C:\Program Files\Python\WinPython-64bit-3.4.3.2\python-3.4.3.amd64\lib\site-packages\IPython\nbformat\current.py:19: UserWarning: IPython.nbformat.current is deprecated.

- use IPython.nbformat for read/write/validate public API
- use IPython.nbformat.vX directly to composing notebooks of a particular version

  """)
Traceback (most recent call last):
  File "C:\Program Files\Python\WinPython-64bit-3.4.3.2\python-3.4.3.amd64\lib\site-packages\IPython\qt\base_frontend_mixin.py", line 138, in _dispatch
    handler(msg)
  File "C:\Program Files\Python\WinPython-64bit-3.4.3.2\python-3.4.3.amd64\lib\site-packages\spyderlib\widgets\ipython.py", line 335, in _handle_inspect_reply
    signature = self.get_signature(content)
  File "C:\Program Files\Python\WinPython-64bit-3.4.3.2\python-3.4.3.amd64\lib\site-packages\spyderlib\widgets\ipython.py", line 271, in get_signature
    signature = getsignaturefromtext(text, name)
  File "C:\Program Files\Python\WinPython-64bit-3.4.3.2\python-3.4.3.amd64\lib\site-packages\spyderlib\utils\dochelpers.py", line 180, in getsignaturefromtext
    sigs_1 = re.findall(oneline_re + '|' + multiline_re, text)
  File "C:\Program Files\Python\WinPython-64bit-3.4.3.2\python-3.4.3.amd64\lib\re.py", line 210, in findall
    return _compile(pattern, flags).findall(string)
  File "C:\Program Files\Python\WinPython-64bit-3.4.3.2\python-3.4.3.amd64\lib\re.py", line 294, in _compile
    p = sre_compile.compile(pattern, flags)
  File "C:\Program Files\Python\WinPython-64bit-3.4.3.2\python-3.4.3.amd64\lib\sre_compile.py", line 568, in compile
    p = sre_parse.parse(p, flags)
  File "C:\Program Files\Python\WinPython-64bit-3.4.3.2\python-3.4.3.amd64\lib\sre_parse.py", line 760, in parse
    p = _parse_sub(source, pattern, 0)
  File "C:\Program Files\Python\WinPython-64bit-3.4.3.2\python-3.4.3.amd64\lib\sre_parse.py", line 370, in _parse_sub
    itemsappend(_parse(source, state))
  File "C:\Program Files\Python\WinPython-64bit-3.4.3.2\python-3.4.3.amd64\lib\sre_parse.py", line 708, in _parse
    p = _parse_sub(source, state)
  File "C:\Program Files\Python\WinPython-64bit-3.4.3.2\python-3.4.3.amd64\lib\sre_parse.py", line 370, in _parse_sub
    itemsappend(_parse(source, state))
  File "C:\Program Files\Python\WinPython-64bit-3.4.3.2\python-3.4.3.amd64\lib\sre_parse.py", line 710, in _parse
    raise error("unbalanced parenthesis")
sre_constants.error: unbalanced parenthesis

@Nodd
Copy link
Contributor

Nodd commented Apr 20, 2015

Thanks, it will be easier to debug !

@ccordoba12 ccordoba12 assigned ccordoba12 and unassigned blink1073 Apr 20, 2015
@ccordoba12 ccordoba12 added this to the v3.0 milestone Apr 20, 2015
@ccordoba12
Copy link
Member

@blink1073 has not worked on this, I've done it, so I'll take a look at this bug :-)

@goanpeca
Copy link
Member

Oops, my bad @blink1073 ;-)

@J3ronimo
Copy link
Author

Thanks guys.
Was anyone able to reproduce this? I also played around with some other imported functions, but so far didn't find any where this happens in the same way...

@Nodd
Copy link
Contributor

Nodd commented Apr 22, 2015

I can reproduce the problem (Linux, python3, with jedi, rope and sphinx installed)

@bilderbuchi
Copy link

I can reproduce this (and confirm it works in a standalone ipython console).
WIndows 8, Miniconda, Spyder 2.3.4, Python 3.4.2, rope, jedi, sphinx installed.

@Nodd
Copy link
Contributor

Nodd commented Apr 23, 2015

Uh sorry, I can reproduce the problem (I updated my comment above).

@drafter250
Copy link

drafter250

it happens with the decimal module if I alias decimal.Decimal

import decimal
D = decimal.Decimal

as soon as you type a second open parenthesis you get the regex error unbalanced parenthesis.

(D( **kaboom!**

Anaconda 2.2 with python 2.7.9, ipython 3.0.0. on windows 7.
heres the traceback:

Traceback (most recent call last):
  File "D:\Continuum\Anaconda\lib\site-packages\IPython\qt\base_frontend_mixin.py", line 138, in _dispatch
    handler(msg)
  File "D:\Continuum\Anaconda\lib\site-packages\spyderlib\widgets\ipython.py", line 335, in _handle_inspect_reply
    signature = self.get_signature(content)
  File "D:\Continuum\Anaconda\lib\site-packages\spyderlib\widgets\ipython.py", line 271, in get_signature
    signature = getsignaturefromtext(text, name)
  File "D:\Continuum\Anaconda\lib\site-packages\spyderlib\utils\dochelpers.py", line 180, in getsignaturefromtext
    sigs_1 = re.findall(oneline_re + '|' + multiline_re, text)
  File "D:\Continuum\Anaconda\lib\re.py", line 181, in findall
    return _compile(pattern, flags).findall(string)
  File "D:\Continuum\Anaconda\lib\re.py", line 251, in _compile
    raise error, v # invalid expression
sre_constants.error: unbalanced parenthesis

@ccordoba12 ccordoba12 changed the title Spyder IPython console: "sre_constants.error: unbalanced parenthesis" while typing IPython console: "sre_constants.error: unbalanced parenthesis" while typing May 30, 2015
@ccordoba12
Copy link
Member

I can confirm this bug, and I think I know how to fix it :-)

@ccordoba12 ccordoba12 modified the milestones: v3.0, v2.3.5 May 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants