Problems with Cherrypy on Windows 8 (Python) - 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.

Related

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

TypeError: 'module' object is not callable using cx_freeze

I've frozen my app with cx_Freeze and when running the .exe I get this error (only error):
C:\Python34\build\exe.win32-3.4>run.exe
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27
, in <module>
exec(code, m.__dict__)
File "run.py", line 18, in <module>
File "C:\Python34\Socket.py", line 5, in openSocket
s = socket.socket()
TypeError: 'module' object is not callable
If I run my app in Python then it works perfectly fine.I have done import socket in both the main python file (run.py) and the one mentioned in the error above (Socket.py)
How do I fix this?
Try renaming your "Socket.py" file to something else ("socket_maker.py"). Then delete all *.pyc files from the current directory (especially anything called socket.pyc).
I'm thinking that the module name you are trying to import is conflicting with the object and function names.

Error with newrelic and zope

I'm trying to configure newrelic with zope but it is returning the error:
# bin/newrelic-admin run-python bin/zeoserver fg
Traceback (most recent call last):
File "bin/zeoserver", line 22, in <module>
import plone.recipe.zeoserver.ctl
File "/opt/bitnami/apps/plone/buildout-cache/eggs/plone.recipe.zeoserver-1.2.6-py2.7.egg/plone/recipe/zeoserver/__init__.py", line 9, in <module>
import zc.recipe.egg
File "/opt/bitnami/apps/plone/buildout-cache/eggs/zc.recipe.egg-1.3.2-py2.7.egg/zc/recipe/egg/__init__.py", line 1, in <module>
from zc.recipe.egg.egg import Egg, Scripts, Eggs
File "/opt/bitnami/apps/plone/buildout-cache/eggs/zc.recipe.egg-1.3.2-py2.7.egg/zc/recipe/egg/egg.py", line 21, in <module>
import zc.buildout.easy_install
File "/opt/bitnami/apps/plone/buildout-cache/eggs/zc.buildout-2.2.5-py2.7.egg/zc/buildout/easy_install.py", line 81, in <module>
pkg_resources.Requirement.parse('zc.buildout')).location,
AttributeError: 'NoneType' object has no attribute 'location'
Does anyone know what can it be pls?
I solved adding the below code in a __init__.py from application:
import newrelic.agent
newrelic.agent.initialize('path/of/newrelic.ini')
And execute the application without the command "newrelic-admin run-python".
Newrelic worked but with limitations because don't have official support yet.

CRegExp error in Ipython

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.

Installing Pandas with Python 2.5 on Windows

I'm trying to get Pandas installed with Python 2.5 on a machine running Windows XP.
The installation seems to finish OK, but when I try
from pandas import *
I get the following error:
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
File "c:\python25\lib\site-packages\pandas-0.7.2-py2.5-win32.egg\pandas\__init__.py", line 24, in <module>
from pandas.stats.api import *
File "c:\python25\lib\site-packages\pandas-0.7.2-py2.5-win32.egg\pandas\stats\api.py", line 7, in <module>
from pandas.stats.moments import *
File "c:\python25\lib\site-packages\pandas-0.7.2-py2.5-win32.egg\pandas\stats\moments.py", line 388, in <module>
rolling_max = _rolling_func(_tseries.roll_max, 'Moving maximum')
File "c:\python25\lib\site-packages\pandas-0.7.2-py2.5-win32.egg\pandas\stats\moments.py", line 379, in _rolling_func
def f(arg, window, min_periods=None, time_rule=None):
File "C:\Python25\Lib\functools.py", line 35, in update_wrapper
getattr(wrapper, attr).update(getattr(wrapped, attr))
AttributeError: 'builtin_function_or_method' object has no attribute '__dict__'
As far as I can tell, I've got all of the dependencies installed correctly, and the problem is something to do with functools.py, which is part of the Python Standard Library(?).
Does anyone have any suggestions, please? Pandas is supposed to work with Python 2.5, so I assume it's a problem with my Python configuration.
Is this the Python distro that came with ArcGIS or Python.org? As discussed on the mailing list this does not seem to be an issue with Python 2.5 per se but potentially your environment

Categories