mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Merge Christoph Holtermann's 'Pr pycons2to3' into maint.
This commit is contained in:
commit
0251d044b5
@ -1,4 +1,4 @@
|
|||||||
#! /usr/bin/env python
|
#! /usr/bin/env python3
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008, Nicolas Rougier
|
# Copyright (c) 2008, Nicolas Rougier
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
@ -35,6 +35,7 @@ import gi
|
|||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
from gi.repository import GObject
|
from gi.repository import GObject
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
|
from gi.repository import Gdk
|
||||||
from gi.repository import Pango
|
from gi.repository import Pango
|
||||||
import io
|
import io
|
||||||
import pycons.shell as shell
|
import pycons.shell as shell
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#! /usr/bin/env python
|
#! /usr/bin/env python3
|
||||||
#
|
#
|
||||||
# Adapted from:
|
# Adapted from:
|
||||||
#
|
#
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#! /usr/bin/env python
|
#! /usr/bin/env python3
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008, Nicolas Rougier
|
# Copyright (c) 2008, Nicolas Rougier
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
@ -63,9 +63,9 @@ class Shell:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
s = line
|
s = line
|
||||||
s = filter(lambda x: x in '()[]{}"\'', s)
|
s = list(filter(lambda x: x in '()[]{}"\'', s))
|
||||||
s = s.replace ("'''", "'")
|
# s = s.replace ("'''", "'")
|
||||||
s = s.replace ('"""', '"')
|
# s = s.replace ('"""', '"')
|
||||||
instring = False
|
instring = False
|
||||||
brackets = {'(':')', '[':']', '{':'}', '"':'"', '\'':'\''}
|
brackets = {'(':')', '[':']', '{':'}', '"':'"', '\'':'\''}
|
||||||
stack = []
|
stack = []
|
||||||
@ -155,7 +155,7 @@ class Shell:
|
|||||||
# Command output
|
# Command output
|
||||||
print(repr(r))
|
print(repr(r))
|
||||||
except SyntaxError:
|
except SyntaxError:
|
||||||
exec(self.command in self.globals)
|
exec(str(self.command), self.globals)
|
||||||
except:
|
except:
|
||||||
if hasattr (sys, 'last_type') and sys.last_type == SystemExit:
|
if hasattr (sys, 'last_type') and sys.last_type == SystemExit:
|
||||||
console.quit()
|
console.quit()
|
||||||
@ -163,10 +163,10 @@ class Shell:
|
|||||||
console.quit()
|
console.quit()
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
tb = sys.exc_traceback
|
tb = sys.exc_info()[2]
|
||||||
if tb:
|
if tb:
|
||||||
tb=tb.tb_next
|
tb=tb.tb_next
|
||||||
traceback.print_exception(sys.exc_type, sys.exc_value, tb)
|
traceback.print_exception(sys.exc_info()[0], sys.exc_info()[1], tb)
|
||||||
except:
|
except:
|
||||||
sys.stderr, console.stderr = console.stderr, sys.stderr
|
sys.stderr, console.stderr = console.stderr, sys.stderr
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
Loading…
Reference in New Issue
Block a user