More Python 3 fixes.

This commit is contained in:
Neil Schemenauer 2016-03-31 21:17:06 +00:00
parent 574b9b1088
commit 2b7b5a8f0e
4 changed files with 11 additions and 8 deletions

View File

@ -164,7 +164,7 @@ class Config:
config_vars = {}
try:
execfile(filename, config_vars)
except IOError, exc:
except IOError as exc:
if exc.filename is None: # arg! execfile() loses filename
exc.filename = filename
raise exc

View File

@ -538,7 +538,7 @@ class HTTPResponse:
output.write(s.encode('utf-8'))
for name, value in self.generate_headers():
s = "%s: %s\r\n" % (name, value))
s = "%s: %s\r\n" % (name, value)
output.write(s.encode('utf-8'))
output.write(b"\r\n")
if flush_output:

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
from sancho.utest import UTest
from quixote.ptl.ptl_compile import compile_template
from StringIO import StringIO
from io import StringIO
from quixote.html import TemplateIO, htmltext
def run_ptl(*source):
@ -45,12 +45,12 @@ class Test (UTest):
try:
run_ptl('def f [] (a):\n a')
assert 0
except SyntaxError, e:
except SyntaxError as e:
assert e.lineno == 1
try:
run_ptl('def f [HTML] (a):\n a')
assert 0
except SyntaxError, e:
except SyntaxError as e:
assert e.lineno == 1
if __name__ == "__main__":

View File

@ -1,14 +1,17 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#try:
# from setuptools import setup
#except ImportError:
# print '(WARNING: importing distutils, not setuptools!)'
# print('(WARNING: importing distutils, not setuptools!)')
# from distutils.core import setup
# Setup script for Quixote
import sys
import os
if sys.version_info < (3,4,0):
raise SystemExit("You need python 3.4.0 or later to run this script")
from distutils import core
from distutils.extension import Extension
from quixote.ptl.qx_distutils import qx_build_py