Skip to content
Permalink
Browse files

Use print function

[ci skip]
  • Loading branch information
mistotebe authored and jwiegley committed Dec 21, 2014
1 parent 85f94ee commit e264eb618b8eabf9670084f40687af916a63567e
Showing with 12 additions and 8 deletions.
  1. +4 −2 python/demo.py
  2. +8 −6 python/server.py
@@ -1,5 +1,7 @@
#!/usr/bin/env python

from __future__ import print_function

import sys
from datetime import datetime

@@ -9,7 +11,7 @@

import ledger

print "Welcome to the Ledger.Python demo!"
print("Welcome to the Ledger.Python demo!")

# Some quick helper functions to help us assert various types of truth
# throughout the script.
@@ -290,4 +292,4 @@ def assertEqual(pat, candidate):
#journal.collect('-M food')
#journal.collect_accounts('^assets ^liab ^equity')

print 'Demo completed successfully.'
print('Demo completed successfully.')
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-

from __future__ import print_function

import ledger
import cgi
import sys
@@ -129,15 +131,15 @@ def do_GET(self):
self.wfile.write(html)

def do_POST(self):
print "Saw a POST request!"
print("Saw a POST request!")
try:
ctype, pdict = cgi.parse_header(self.headers.getheader('content-type'))
if ctype == 'multipart/form-data':
query = cgi.parse_multipart(self.rfile, pdict)
self.send_response(301)
self.end_headers()
except Exception:
print "Saw exception in POST handler"
print("Saw exception in POST handler")

# This code is straight from SimpleHTTPServer.py
def copyfile(self, source, outputfile):
@@ -182,15 +184,15 @@ def main(*args):
try:
port = 9000
server = HTTPServer(('', port), LedgerHandler)
print "Local HTTP server listening on port %d... (Control-C to exit)" \
% port
print("Local HTTP server listening on port %d... (Control-C to exit)" \
% port)
server.serve_forever()
except KeyboardInterrupt:
print "Shutting down server"
print("Shutting down server")
server.socket.close()

if __name__ == '__main__':
if len(sys.argv) < 3:
print "usage: server.py <DATA-FILE> <REPORT-QUERY>"
print("usage: server.py <DATA-FILE> <REPORT-QUERY>")
sys.exit(1)
main()

0 comments on commit e264eb6

Please sign in to comment.
You can’t perform that action at this time.