Changeset 5964

Show
Ignore:
Timestamp:
08/27/10 11:21:09 (1 year ago)
Author:
paul
Message:

Switched from os.system() and os.popen2() to subprocess.call()
in previewPDF() and printPDF(). Removes DeprecationWarnings? in
Python 2.6 and above.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/dabo/lib/reportUtils.py

    r5932 r5964  
    11# -*- coding: utf-8 -*- 
    2 import datetime 
    3  
    4 from decimal import Decimal 
    52import os 
    63import sys 
     4import subprocess 
    75import tempfile 
     6import datetime 
     7from decimal import Decimal 
    88 
    99 
     
    4141    """Preview the passed PDF file in the default PDF viewer.""" 
    4242    try: 
     43        # On Windows, use the default PDF viewer (probably Adobe Acrobat) 
    4344        os.startfile(path) 
    4445    except AttributeError: 
    45         # startfile only available on Windows 
     46        # On Mac, use the default PDF viewer (probably Preview.app) 
    4647        if sys.platform == "darwin": 
    4748            os.system("open %s" % path) 
     
    6162 
    6263            if viewer: 
    63                 if modal: 
    64                     sysfunc = os.system 
    65                 else: 
    66                     sysfunc = os.popen2 
    67                 sysfunc("%s '%s'" % (viewer, path)) 
     64                subprocess.call((viewer, path)) 
    6865 
    6966 
     
    7572    except AttributeError: 
    7673        # startfile() only available on Windows 
    77         os.system("lpr %s" % path
     74        subprocess.call(("lpr", path)
    7875 
    7976