summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/IOBinding.py
diff options
context:
space:
mode:
authorKurt B. Kaiser <kbk@shore.net>2003-06-09 03:12:42 (GMT)
committerKurt B. Kaiser <kbk@shore.net>2003-06-09 03:12:42 (GMT)
commit9067c8d85c4774118675436208cadf59bb048552 (patch)
treefcdf0e267e0322731089c2777b8e432a80d49add /Lib/idlelib/IOBinding.py
parent2f3c74a538e3b15b174c9f99866babe33f2dc124 (diff)
downloadcpython-9067c8d85c4774118675436208cadf59bb048552.zip
cpython-9067c8d85c4774118675436208cadf59bb048552.tar.gz
cpython-9067c8d85c4774118675436208cadf59bb048552.tar.bz2
SF 748975 Printing unsaved shell fails
M IOBinding.py
Diffstat (limited to 'Lib/idlelib/IOBinding.py')
-rw-r--r--Lib/idlelib/IOBinding.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/idlelib/IOBinding.py b/Lib/idlelib/IOBinding.py
index e207750..0cc9a5f 100644
--- a/Lib/idlelib/IOBinding.py
+++ b/Lib/idlelib/IOBinding.py
@@ -459,9 +459,12 @@ class IOBinding:
def print_window(self, event):
tempfilename = None
- if self.get_saved():
+ saved = self.get_saved()
+ if saved:
filename = self.filename
- else:
+ # shell undo is reset after every prompt, looks saved, probably isn't
+ if not saved or filename is None:
+ # XXX KBK 08Jun03 Wouldn't it be better to ask the user to save?
filename = tempfilename = tempfile.mktemp()
if not self.writefile(filename):
os.unlink(tempfilename)
@@ -479,6 +482,7 @@ class IOBinding:
if printPlatform: #we can try to print for this platform
command = command % filename
pipe = os.popen(command, "r")
+ # things can get ugly on NT if there is no printer available.
output = pipe.read().strip()
status = pipe.close()
if status: