CRegExp error in Ipython - python

I love ipython, I am learning python now as a replacement of R for data analysis. However at promt I get the following message:
$ ipython --qtconsole
Traceback (most recent call last):
File "/Library/Frameworks/EPD64.framework/Versions/Current/bin/ipython", line 5, in <module>
from IPython.frontend.terminal.ipapp import launch_new_instance
File "/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/IPython/__init__.py", line 46, in <module>
from .frontend.terminal.embed import embed
File "/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/IPython/frontend/terminal/embed.py", line 39, in <module>
from IPython.frontend.terminal.interactiveshell import TerminalInteractiveShell
File "/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/IPython/frontend/terminal/interactiveshell.py", line 33, in <module>
from IPython.core.interactiveshell import InteractiveShell, InteractiveShellABC
File "/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 44, in <module>
from IPython.core import prefilter
File "/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/IPython/core/prefilter.py", line 48, in <module>
from IPython.utils.traitlets import (
ImportError: cannot import name CRegExp
Ipython worked just fine a week ago and now I get this error. Can anybody suggest what might be causing this?

As #favoretti mentioned, this is an import issue in utils.traitlets.
I would recommend upgrading to EPD 7.3 and see if that fixes the issue. I feel bad suggesting a "brush it under the carpet" solution but if you're just starting out with python delving into the bowels of IPython might be a bit of a headache.

Related

ImportError: cannot import name 'winrandom'

I know that this question has already a ton of answers but unfortunately this hasn't fixed the issue for me. I want to run some code using PyCrytpo but winrandom doesn't want to get import.
All the other posts are for earlier releases of python. I am using Python 3.6.5 and renaming code within nt.py file to "from . import winrandom" doesn't do the trick for me.
Do you have any suggestions or is a rollback the only opportunity?
Windows 10
Python 3.6.5
Anaconda
from Crypto.PublicKey import RSA
Traceback (most recent call last):
File "<ipython-input-39-b6fe4d249eef>", line 1, in <module>
from Crypto.PublicKey import RSA
File "C:\Users\Markus\Anaconda3\lib\site-packages\Crypto\PublicKey\RSA.py", line 78, in <module>
from Crypto import Random
File "C:\Users\Markus\Anaconda3\lib\site-packages\Crypto\Random\__init__.py", line 28, in <module>
from Crypto.Random import OSRNG
File "C:\Users\Markus\Anaconda3\lib\site-packages\Crypto\Random\OSRNG\__init__.py", line 34, in <module>
from Crypto.Random.OSRNG.nt import new
File "C:\Users\Markus\Anaconda3\lib\site-packages\Crypto\Random\OSRNG\nt.py", line 28, in <module>
from . import winrandom
ImportError: cannot import name 'winrandom'

error when importing cgi

i am running python 3.2.6 on an a2hosting shared server. when i do
import cgi
i get:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python3.2/cgi.py", line 38, in <module>
from email.parser import FeedParser
File "/usr/lib64/python3.2/email/parser.py", line 12, in <module>
from email.feedparser import FeedParser, BytesFeedParser
File "/usr/lib64/python3.2/email/feedparser.py", line 27, in <module>
from email import message
File "/usr/lib64/python3.2/email/message.py", line 19, in <module>
from email import header
File "/usr/lib64/python3.2/email/header.py", line 17, in <module>
import email.base64mime
EOFError: EOF read where not expected
how can i solve this? i do not have root access.
edit:
this is the answer i got from a2hosting support:
Hello, Unfortunately, we really cannot provide development assistance here. This is quite above and beyond our scope of support. While we'd like to be able to provide support for each and every program, language, script, etc, that comes out, it's just physically impossible to do so. You'll want to work with your development team, or the applications developers to ensure that this is something that's investigated thoroughly.
i circumvented the issue by installing a different version of python, following this: https://www.a2hosting.com/kb/developer-corner/python/using-a-newer-version-of-python

Xlwings error in using python modules

I'm attempting to use Xlwings for Python, however having installed Python 3.5, pywin32 extensions and Xlwings I get the following error when starting import:
from xlwings import workbook
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
from xlwings import workbook
File "C:\Python 3.5\lib\site-packages\xlwings\__init__.py", line 18, in <module>
from . import _xlwindows as xlplatform
File "C:\Python 3.5\lib\site-packages\xlwings\_xlwindows.py", line 15, in <module>
import pywintypes
File "C:\Python 3.5\lib\site-packages\win32\lib\pywintypes.py", line 124, in <module>
__import_pywin32_system_module__("pywintypes", globals())
File "C:\Python 3.5\lib\site-packages\win32\lib\pywintypes.py", line 117, in __import_pywin32_system_module__
assert sys.modules[modname] is not old_mod
AssertionError
Try commenting out the asserts (replace them with a pass) and see if it works. Otherwise you're going to need to debug pywintypes.
Felix Zumstein just informed me that the above suggestion won't work:
When you comment out those lines, then it fails further down when doing from pywintypes import TimeType: ImportError: cannot import name 'TimeType'
However, downgrading may solve this problem.
After Much trial and error ive found that downgrading to Python 3.3 works
Thnak you for all the responses

Using matplotlib on Cloud 9 Ide

I'm trying to use matplotlib on Cloud9 ide, but here's what happens:
>>> import matplotlib
>>> matplotlib.use('Agg')
>>> from matplotlib import pyplot
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 24, in <module>
import matplotlib.colorbar
File "/usr/lib/pymodules/python2.7/matplotlib/colorbar.py", line 29, in <module>
import matplotlib.collections as collections
File "/usr/lib/pymodules/python2.7/matplotlib/collections.py", line 23, in <module>
import matplotlib.backend_bases as backend_bases
File "/usr/lib/pymodules/python2.7/matplotlib/backend_bases.py", line 50, in <module>
import matplotlib.textpath as textpath
File "/usr/lib/pymodules/python2.7/matplotlib/textpath.py", line 5, in <module>
import urllib
File "/usr/lib/python2.7/urllib.py", line 26, in <module>
import socket
File "socket.py", line 5, in <module>
This module provides socket operations and some related functions.
AttributeError: 'module' object has no attribute 'AF_INET'
The Cloud9 Support people have told me that there's nothing wrong with my platform and that matplotLib might not support being initialized within an environment that only has console access. However I remember using matplotlib in the exact same way on Cloud9 about a year ago.
Could anyone explain to me what exactly this error means and if there is a way to get around it?
It seems this is an older version of matplotlib.
Take a note on commit f4adec7 from Aug 2013 where "import urllib" line has been removed from textpath.py. This change is present as early as in matplotlib v1.4.0.

Problems with Cherrypy on Windows 8 (Python)

I have successfully installed cherrypy but when I try to import it, I get following error. I am a newbie and have spent quite a bit of time trying to get this to work, so any help would be highly appreciated.
Traceback (most recent call last):
File "unitconverter.py", line 1, in <module>
import cherrypy
File "c:\Python34\lib\site-packages\cherrypy-3.2.0-py3.4.egg\cherrypy\__init__
.py", line 82, in <module>
from cherrypy import process
File "c:\Python34\lib\site-packages\cherrypy-3.2.0-py3.4.egg\cherrypy\process\
__init__.py", line 14, in <module>
from cherrypy.process import plugins, servers
File "c:\Python34\lib\site-packages\cherrypy-3.2.0-py3.4.egg\cherrypy\process\
plugins.py", line 424, in <module>
class PerpetualTimer(threading._Timer):
AttributeError: 'module' object has no attribute '_Timer'
From what I can see, it's a bug with that version of CherryPy. You'd be best upgrading to a more recent version instead.

Categories