问题描述:

I've installed Python 3.3 on a Windows 7 machine. I wanted to try to the Bottle micro web

framework. I downloaded the bottle.py (latest version from their site) and put it in my app

folder.

When I do the first line in the tutorial, "from bottle import route, run, template"

I got this error message:

*C:\Dev>python

Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:57:17) [MSC v.1600 64 bit (AM

D64)] on win32

Type "help", "copyright", "credits" or "license" for more information.

>>> from bottle import route,run,template

Traceback (most recent call last):

File "<stdin>", line 1, in <module>

File ".\bottle.py", line 564

raise exc_info[0], exc_info[1], exc_info[2]

^

SyntaxError: invalid syntax

>>>*

Any suggestions how I can fix this problem and continue?

Thanks

网友答案:

You need to follow the bottle installation instructions.

The latest version is published to PyPI, you have an old version of the code there still, one that is not compatible with Python 3.

网友答案:

The format

raise Exception, args

is not there anymore in Python 3+.

That is why the statement is throwing syntax error:

raise exc_info[0], exc_info[1], exc_info[2]
网友答案:

That was a bug introduced 5 days ago and fixed today. Just download bottle.py again. Or use a stable release as suggested by Martijn Pieters

相关阅读:
Top