I'm trying to use Mezzanine cms in a shared hosting at 1and1. I installed a recent python version 3.3.2.
setup works well but when i try to create a project I got the following error message:
~/Mezzanine-1.4.16 > mezzanine-project blog
Traceback (most recent call last):
File "/kunden/homepages/x/dxxxxxxx/htdocs/custom/bin/mezzanine-project", line 9, in
load_entry_point('Mezzanine==1.4.16', 'console_scripts', 'mezzanine-project')()
File "/kunden/homepages/x/dxxxxxxx/htdocs/custom/lib/python3.3/site-packages/distribute-0.6.49-py3.3.egg/pkg_resources.py", line 345, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/kunden/homepages/x/dxxxxxxx/htdocs/custom/lib/python3.3/site-packages/distribute-0.6.49-py3.3.egg/pkg_resources.py", line 2382, in load_entry_point
return ep.load()
File "/kunden/homepages/x/dxxxxxxx/htdocs/custom/lib/python3.3/site-packages/distribute-0.6.49-py3.3.egg/pkg_resources.py", line 2088, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/kunden/homepages/x/dxxxxxxx/htdocs/custom/lib/python3.3/site-packages/Mezzanine-1.4.16-py3.3.egg/mezzanine/bin/mezzanine_project.py", line 9, in
from mezzanine.utils.importing import path_for_import
File "/kunden/homepages/x/dxxxxxxx/htdocs/custom/lib/python3.3/site-packages/Mezzanine-1.4.16-py3.3.egg/mezzanine/utils/importing.py", line 23
except (ValueError, ImportError, AttributeError), e:
^
SyntaxError: invalid syntax
Any thoughts on how to fix this ? thank you.
Current version of Mezzanine (1.4.16) doesn’t support Python 3. You have to use Python 2.6 / 2.7 (Source: dependencies section in official docs).
Now supporting with Mezzanine 3.x
Related
I just installed Python 2.7.5 on my Windows 10 machine and I also got pip installed through setuptools. However whenever I try to install something using pip e.g. pip install numpy, I get this error message:
Traceback (most recent call last):
File "C:\Python27\Scripts\pip-script.py", line 8, in <module>
load_entry_point('pip==9.0.1', 'console_scripts', 'pip')()
File "C:\Python27\lib\site-packages\pkg_resources.py", line 318, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "C:\Python27\lib\site-packages\pkg_resources.py", line 2221, in load_entry_point
return ep.load()
File "C:\Python27\lib\site-packages\pkg_resources.py", line 1954, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "C:\Python27\lib\site-packages\pip-9.0.1-py2.7.egg\pip\__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "C:\Python27\lib\site-packages\pip-9.0.1-py2.7.egg\pip\utils\__init__.py", line 27, in <module>
from pip._vendor import pkg_resources
File "C:\Python27\lib\site-packages\pip-9.0.1-py2.7.egg\pip\_vendor\pkg_resources\__init__.py", line 73, in <module>
__import__('pip._vendor.packaging.specifiers')
File "C:\Python27\lib\site-packages\pip-9.0.1-py2.7.egg\pip\_vendor\packaging\specifiers.py", line 275, in <module>
class Specifier(_IndividualSpecifier):
File "C:\Python27\lib\site-packages\pip-9.0.1-py2.7.egg\pip\_vendor\packaging\specifiers.py", line 373, in Specifier
r"^\s*" + _regex_str + r"\s*$", re.VERBOSE | re.IGNORECASE)
File "C:\Python27\Lib\re.py", line 190, in compile
return _compile(pattern, flags)
File "C:\Python27\Lib\re.py", line 242, in _compile
raise error, v # invalid expression
sre_constants.error: nothing to repeat
Since I'm pretty new to Python, I don't really understand what this error means. Any workaround?
I had a similar issue with a library that is using regular expressions (with the re.compile() function). I solved this issue installing the last version available 2.7.13 (I run a Windows 7).
Before I had the 2.7.6 version. I updated it installing the new version with the .msi installer, available in the Python web page.
I tried to download pip with easy install but after installation whenever I type pip into the mac terminal it gives me this error:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 8, in <module>
load_entry_point('pip==7.0.3', 'console_scripts', 'pip')()
File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 271, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 2173, in load_entry_point
return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 1906, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/Library/Python/2.5/site-packages/pip-7.0.3-py2.5.egg/pip/__init__.py", line 211
except PipError as exc:
^
SyntaxError: invalid syntax
and when I try to do pip install pyopengl, it gives me the same error. What do I do to fix this?
Modern pip works with Python 2.6 and higher. It seems you got Python 2.5, so you either need to upgrade Python or use older version of pip.
According to the documentation Python 2.5 was supported through v1.3.1 of pip.
When I run the command scrapy startproject tutorial, i get lots of lines of errors and at the end AttributeError:'NoneType'object has no attribute 'startswith'. In the previous lines it is pointing to various lines in various files
c:\Python27>scrapy startproject tutorial
Traceback(most recent call last):
File "C:\Python32\Scripts\scrapy-script.py", line 9, in <module>
load_entry_point('Scrapy==0.24.4', 'console_scripts', 'scrapy')()
File "C:\Python32\lib\site-packages\pkg_resources\__init__.py", line 519, in load_entry_point
return get_distribution(dist).load_entry_point(group,name)
File "C:\Python32\lib\site-packages\pkg_resources\__init__.py", line 2630, in load_entry_point
return ep.load()
File "C:\Python32\lib\site-packages\pkg_resources\__init__.py", line 2310, in load
return self.resolve()
File "C:\Python32\lib\site-packages\pkg_resources\__init__.py",line 2316, in resolve
module=__import__(self.module_name, fromlist=['__name__'], level=0)
File "C:\Python32\lib\site-packages\scrapy\__init__.py", line 10, in <module>
__version__=pkgutil.get_data(__package__, 'VERSION').decode('ascii').strip()
File "C:\Python32\lin\pkgutil.py", line 565, in get_data
loader=get_loader(package)
File "C:\Python32\lib\pkgutil.py", line 453, in get_loader
return find_loader(fullname)
File "C:\Python32\lib\pkgutil.py", line 463, in find_loader
for importer in iter_importers(fullname):
File "C:\Python32\lib\pkgutil.py", line 413, in iter_importers
if fullname.startswith('.'):
AttributeError: 'NoneType'object has no attribute 'startswith'
Scrapy does not support Python 3:
What Python versions does Scrapy support? Scrapy is supported under
Python 2.7 only. Python 2.6 support was dropped starting at Scrapy
0.20.
Does Scrapy work with Python 3? No, but there are plans to support
Python 3.3+. At the moment, Scrapy works with Python 2.7.
You need to use Python 2.7.
I tried to install django on my shared hosting environment, which has SSH access.
I downloaded the newest version of Django using
svn export http://code.djangoproject.com/svn/django/trunk/django django
I can import Django in python shell without any error throwing.
But then I tried to start a new project using django-admin.py and it started throwing me a bunch of error, in which I tried to google for the past few hours. I still can't find it
Below is the actual error:
k4660061#server42222:~$ django-admin.py startproject klikevent
/u/k4660061/home/local/lib/python/site-packages/django/core/management/templates.py:155: Warning: 'with' will become a reserved keyword in Python 2.6
Traceback (most recent call last):
File "/u/k4660061/home/local/lib/python/site-packages/django/bin/django-admin.py", line 5, in <module>
management.execute_from_command_line()
File "/u/k4660061/home/local/lib/python/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
utility.execute()
File "/u/k4660061/home/local/lib/python/site-packages/django/core/management/__init__.py", line 381, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/u/k4660061/home/local/lib/python/site-packages/django/core/management/__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/u/k4660061/home/local/lib/python/site-packages/django/core/management/__init__.py", line 69, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/u/k4660061/home/local/lib/python/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/u/k4660061/home/local/lib/python/site-packages/django/core/management/commands/startproject.py", line 2, in <module>
from django.core.management.templates import TemplateCommand
File "/u/k4660061/home/local/lib/python/site-packages/django/core/management/templates.py", line 155
with open(old_path, 'r') as template_file:
^
SyntaxError: invalid syntax
k4660061#server42222:~$
Thanks
UPDATE
After a good night sleep, I got it working! See answer by Bernie. I have to see the stacktrace over and over, but I just need to add the import statement to multiple file
the file are
django/utils/archive.py
django/core/management/templates.py
and any file that throw the warning with_statement
Thanks #Bernie
If the syntax error is related to the with statement, it could be that your prod server has an older version of Python than your dev server.
If your prod server is running version 2.5 or higher you can do this:
from __future__ import with_statement
Please note: any from __future__ imports must be the very first import.
Reference: http://docs.python.org/reference/simple_stmts.html#future
No idea what happened, but all of a sudden, paster stopped working on my server (working with virtualenv and pyramid). Tried reinstalling everything but didn't work - same error again:
Traceback (most recent call last):
File "bin/paster", line 7, in ?
sys.exit(
File "/home/user/webapps/myapp/htdocs/lib/python2.4/site-packages/PasteScript-1.7.3-py2.4.egg/paste/script/command.py", line 83, in run
command = commands[command_name].load()
File "/home/user/webapps/myapp/htdocs/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/pkg_resources.py", line 1954, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/home/user/webapps/myapp/htdocs/lib/python2.4/site-packages/PasteScript-1.7.3-py2.4.egg/paste/script/serve.py", line 19, in ?
from paste.deploy import loadapp, loadserver
File "/home/user/webapps/myapp/htdocs/lib/python2.4/site-packages/PasteDeploy-1.5.0-py2.4.egg/paste/deploy/__init__.py", line 3, in ?
from paste.deploy.loadwsgi import *
File "/home/user/webapps/myapp/htdocs/lib/python2.4/site-packages/PasteDeploy-1.5.0-py2.4.egg/paste/deploy/loadwsgi.py", line 393
with open(filename) as f:
^
SyntaxError: invalid syntax
What is happening to me?
You are using Python 2.4. It does not have the with statement. It only came in Python 2.5.
Update your version of Python.