~ubuntu-core-dev/ubuntu/xenial/ubuntu-release-upgrader/xenial

« back to all changes in this revision

Viewing changes to DistUpgrade/DistUpgradeMain.py

  • Committer: Dimitri John Ledkov
  • Date: 2015-01-20 22:30:06 UTC
  • mto: This revision was merged to the branch mainline in revision 2859.
  • Revision ID: dimitri.j.ledkov@intel.com-20150120223006-ba30fbqtp4x2n0og
Fix resource warnings & logging.warn deprecation warning.

Show diffs side-by-side

added added

removed removed

Lines of Context:
133
133
    try:
134
134
        s=subprocess.Popen(["lspci","-nn"], stdout=subprocess.PIPE,
135
135
                           universal_newlines=True).communicate()[0]
136
 
        open(os.path.join(logdir, "lspci.txt"), "w").write(s)
 
136
        with open(os.path.join(logdir, "lspci.txt"), "w") as f:
 
137
            f.write(s)
137
138
    except OSError as e:
138
139
        logging.debug("lspci failed: %s" % e)
139
140