简体   繁体   中英

Python error importing bottle.py on Windows 7

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM