← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:avoid-sys-executable into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:avoid-sys-executable into launchpad:master.

Commit message:
Remove unnecessary uses of sys.executable

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/408088

In these cases we're running scripts that already have a perfectly good `#!` line, so there's no need to explicitly invoke them using `sys.executable`.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:avoid-sys-executable into launchpad:master.
diff --git a/lib/lp/archivepublisher/tests/test_processdeathrow.py b/lib/lp/archivepublisher/tests/test_processdeathrow.py
index a59381a..3c48f98 100644
--- a/lib/lp/archivepublisher/tests/test_processdeathrow.py
+++ b/lib/lp/archivepublisher/tests/test_processdeathrow.py
@@ -14,7 +14,6 @@ import datetime
 import os
 import shutil
 import subprocess
-import sys
 from tempfile import mkdtemp
 
 import pytz
@@ -40,7 +39,7 @@ class TestProcessDeathRow(TestCaseWithFactory):
     def runDeathRow(self, extra_args, distribution="ubuntutest"):
         """Run process-death-row.py, returning the result and output."""
         script = os.path.join(config.root, "scripts", "process-death-row.py")
-        args = [sys.executable, script, "-v", "-p", self.primary_test_folder]
+        args = [script, "-v", "-p", self.primary_test_folder]
         args.extend(extra_args)
         process = subprocess.Popen(
             args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
diff --git a/lib/lp/archivepublisher/tests/test_publishdistro.py b/lib/lp/archivepublisher/tests/test_publishdistro.py
index 41d81f4..c0f88d0 100644
--- a/lib/lp/archivepublisher/tests/test_publishdistro.py
+++ b/lib/lp/archivepublisher/tests/test_publishdistro.py
@@ -9,7 +9,6 @@ from optparse import OptionValueError
 import os
 import shutil
 import subprocess
-import sys
 
 import six
 from storm.store import Store
@@ -84,7 +83,7 @@ class TestPublishDistro(TestNativePublishingBase):
     def runPublishDistroScript(self):
         """Run publish-distro.py, returning the result and output."""
         script = os.path.join(config.root, "scripts", "publish-distro.py")
-        args = [sys.executable, script, "-v", "-d", "ubuntutest"]
+        args = [script, "-v", "-d", "ubuntutest"]
         process = subprocess.Popen(
             args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
         stdout, stderr = process.communicate()
diff --git a/lib/lp/archiveuploader/tests/test_processupload.py b/lib/lp/archiveuploader/tests/test_processupload.py
index 29917b5..ee6094a 100644
--- a/lib/lp/archiveuploader/tests/test_processupload.py
+++ b/lib/lp/archiveuploader/tests/test_processupload.py
@@ -6,7 +6,6 @@ __metaclass__ = type
 import os
 import shutil
 import subprocess
-import sys
 import tempfile
 import unittest
 
@@ -32,7 +31,7 @@ class TestProcessUpload(unittest.TestCase):
         if extra_args is None:
             extra_args = []
         script = os.path.join(config.root, "scripts", "process-upload.py")
-        args = [sys.executable, script, "-vvv", self.queue_location]
+        args = [script, "-vvv", self.queue_location]
         args.extend(extra_args)
         process = subprocess.Popen(
             args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
diff --git a/lib/lp/bugs/doc/cve-update.txt b/lib/lp/bugs/doc/cve-update.txt
index 5ca5f00..8b5d910 100644
--- a/lib/lp/bugs/doc/cve-update.txt
+++ b/lib/lp/bugs/doc/cve-update.txt
@@ -16,7 +16,6 @@ the case.
     >>> import os.path
     >>> import shutil
     >>> import subprocess
-    >>> import sys
     >>> import tempfile
     >>> import transaction
     >>> from lp.services.config import config
@@ -45,7 +44,7 @@ Now run the cronscript.
     ...                 shutil.copyfileobj(uncompressed, compressed)
     ...         url = 'file://%s' % compressed_path
     ...         process = subprocess.Popen(
-    ...             [sys.executable, script, '-u', url],
+    ...             [script, '-u', url],
     ...             stdin=subprocess.PIPE, stdout=subprocess.PIPE,
     ...             stderr=subprocess.STDOUT, universal_newlines=True)
     ...         return process.communicate()
diff --git a/lib/lp/services/librarianserver/tests/test_gc.py b/lib/lp/services/librarianserver/tests/test_gc.py
index 31c3830..a488abb 100644
--- a/lib/lp/services/librarianserver/tests/test_gc.py
+++ b/lib/lp/services/librarianserver/tests/test_gc.py
@@ -20,7 +20,6 @@ from subprocess import (
     Popen,
     STDOUT,
     )
-import sys
 import tempfile
 
 from fixtures import MockPatchObject
@@ -570,7 +569,7 @@ class TestLibrarianGarbageCollectionBase:
         script_path = os.path.join(
                 config.root, 'cronscripts', 'librarian-gc.py'
                 )
-        cmd = [sys.executable, script_path, '-q']
+        cmd = [script_path, '-q']
         process = Popen(
             cmd, stdout=PIPE, stderr=STDOUT, stdin=PIPE,
             universal_newlines=True)
@@ -1291,7 +1290,7 @@ class TestBlobCollection(TestCase):
         script_path = os.path.join(
                 config.root, 'cronscripts', 'librarian-gc.py'
                 )
-        cmd = [sys.executable, script_path, '-q']
+        cmd = [script_path, '-q']
         process = Popen(
             cmd, stdout=PIPE, stderr=STDOUT, stdin=PIPE,
             universal_newlines=True)
diff --git a/lib/lp/services/scripts/doc/launchpad-scripts.txt b/lib/lp/services/scripts/doc/launchpad-scripts.txt
index 9a51be6..761052e 100644
--- a/lib/lp/services/scripts/doc/launchpad-scripts.txt
+++ b/lib/lp/services/scripts/doc/launchpad-scripts.txt
@@ -12,13 +12,13 @@ LaunchpadScript. Unhandled exceptions from scripts are automatically
 sent to the Python logging system. Cronscripts (scripts using
 LaunchpadCronScript) also log warnings and and errors as OOPS reports.
 
-    >>> import os.path, subprocess, sys
+    >>> import os.path, subprocess
     >>> from lp.services.config import config
     >>> cronscript_crash_path = os.path.join(
     ...     config.root, 'lib', 'lp', 'services', 'scripts', 'tests',
     ...     'cronscript-crash.py')
     >>> p = subprocess.Popen(
-    ...     [sys.executable, cronscript_crash_path, '-vq'],
+    ...     [cronscript_crash_path, '-vq'],
     ...     stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
     ...     stdin=subprocess.PIPE, universal_newlines=True)
     >>> print(p.communicate()[0])
diff --git a/lib/lp/services/statistics/tests/test_update_stats.py b/lib/lp/services/statistics/tests/test_update_stats.py
index 32550b8..9771580 100644
--- a/lib/lp/services/statistics/tests/test_update_stats.py
+++ b/lib/lp/services/statistics/tests/test_update_stats.py
@@ -7,7 +7,6 @@ __metaclass__ = type
 
 import os
 import subprocess
-import sys
 import unittest
 
 from zope.component import getUtility
@@ -82,7 +81,7 @@ class UpdateStatsTest(unittest.TestCase):
         self.layer.txn.commit()
 
         # Run the update-stats.py script
-        cmd = [sys.executable, get_script(), '--quiet']
+        cmd = [get_script(), '--quiet']
         process = subprocess.Popen(
             cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
             stderr=subprocess.STDOUT, universal_newlines=True)
@@ -263,7 +262,7 @@ class UpdateTranslationStatsTest(unittest.TestCase):
 
         # Run update-stats.py script to see that we don't count the
         # information in that template anymore.
-        cmd = [sys.executable, get_script(), '--quiet']
+        cmd = [get_script(), '--quiet']
         process = subprocess.Popen(
             cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
             stderr=subprocess.STDOUT)
@@ -346,7 +345,7 @@ class UpdateTranslationStatsTest(unittest.TestCase):
 
         # Run update-stats.py script to see that we don't count the
         # information in the moz_english_pofile template.
-        cmd = [sys.executable, get_script(), '--quiet']
+        cmd = [get_script(), '--quiet']
         process = subprocess.Popen(
             cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
             stderr=subprocess.STDOUT)
diff --git a/lib/lp/soyuz/doc/buildd-mass-retry.txt b/lib/lp/soyuz/doc/buildd-mass-retry.txt
index bfc8726..03ec6f4 100644
--- a/lib/lp/soyuz/doc/buildd-mass-retry.txt
+++ b/lib/lp/soyuz/doc/buildd-mass-retry.txt
@@ -3,7 +3,6 @@ Buildd-mass-retry behaviour
 
     >>> import subprocess
     >>> import os
-    >>> import sys
     >>> from lp.services.config import config
 
 'buildd-mass-retry' is a tool designed to retry a group of 'failed'
@@ -31,7 +30,7 @@ See binarypackagebuild.txt for more information about IBuild.retry().
 Passing only suite, request retry on all failed states:
 
     >>> process = subprocess.Popen(
-    ...     [sys.executable, script, "-v", "-NFDC", "-s", "hoary"],
+    ...     [script, "-v", "-NFDC", "-s", "hoary"],
     ...     stdout=subprocess.PIPE, stderr=subprocess.PIPE,
     ...     universal_newlines=True)
     >>> stdout, stderr = process.communicate()
@@ -70,7 +69,7 @@ Let's mark the build from the previous run superseded.
 A new run doesn't pick it up.
 
     >>> process = subprocess.Popen(
-    ...     [sys.executable, script, "-v", "-NFDC", "-s", "hoary"],
+    ...     [script, "-v", "-NFDC", "-s", "hoary"],
     ...     stdout=subprocess.PIPE, stderr=subprocess.PIPE,
     ...     universal_newlines=True)
     >>> stdout, stderr = process.communicate()
@@ -97,10 +96,7 @@ Passing an architecture, which contains no failed build records,
 nothing is done:
 
     >>> process = subprocess.Popen(
-    ...     [
-    ...         sys.executable, script,
-    ...         "-v", "-NFDC", "-s", "hoary", "-a", "hppa",
-    ...     ],
+    ...     [script, "-v", "-NFDC", "-s", "hoary", "-a", "hppa"],
     ...     stdout=subprocess.PIPE, stderr=subprocess.PIPE,
     ...     universal_newlines=True)
     >>> stdout, stderr = process.communicate()
@@ -122,7 +118,7 @@ nothing is done:
 Selecting only a specific failed state:
 
     >>> process = subprocess.Popen(
-    ...     [sys.executable, script, "-v", "-NF", "-s", "hoary"],
+    ...     [script, "-v", "-NF", "-s", "hoary"],
     ...     stdout=subprocess.PIPE, stderr=subprocess.PIPE,
     ...     universal_newlines=True)
     >>> stdout, stderr = process.communicate()
diff --git a/lib/lp/soyuz/doc/closing-bugs-from-changelogs.txt b/lib/lp/soyuz/doc/closing-bugs-from-changelogs.txt
index 75f99ff..84f8a7c 100644
--- a/lib/lp/soyuz/doc/closing-bugs-from-changelogs.txt
+++ b/lib/lp/soyuz/doc/closing-bugs-from-changelogs.txt
@@ -297,11 +297,10 @@ queue items have been processed.
 
     >>> import os.path
     >>> import subprocess
-    >>> import sys
     >>> from lp.services.config import config
     >>> script = os.path.join(config.root, "scripts/process-accepted.py")
     >>> process = subprocess.Popen(
-    ...     [sys.executable, script, "ubuntu"],
+    ...     [script, "ubuntu"],
     ...     stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     >>> stdout, stderr = process.communicate()
     >>> process.returncode
diff --git a/lib/lp/soyuz/doc/gina-multiple-arch.txt b/lib/lp/soyuz/doc/gina-multiple-arch.txt
index 0bcc976..b19bdf1 100644
--- a/lib/lp/soyuz/doc/gina-multiple-arch.txt
+++ b/lib/lp/soyuz/doc/gina-multiple-arch.txt
@@ -64,7 +64,7 @@ Check it was properly created and create its DistroArchSeriess.
 
 Let's set up the filesystem:
 
-    >>> import subprocess, sys, os
+    >>> import subprocess, os
     >>> try:
     ...     os.unlink("/var/lock/launchpad-gina.lock")
     ... except OSError:
@@ -77,8 +77,7 @@ Let's set up the filesystem:
     >>> path = os.path.join(os.getcwd(), relative_path)
     >>> os.symlink(path, '/tmp/gina_test_archive')
 
-    >>> gina_proc = [sys.executable, 'scripts/gina.py', '-q',
-    ...              'dapper', 'dapper-updates']
+    >>> gina_proc = ['scripts/gina.py', '-q', 'dapper', 'dapper-updates']
     >>> proc = subprocess.Popen(
     ...     gina_proc, stderr=subprocess.PIPE, universal_newlines=True)
     >>> print(proc.stderr.read())
diff --git a/lib/lp/soyuz/doc/gina.txt b/lib/lp/soyuz/doc/gina.txt
index 894c39f..4cecccf 100644
--- a/lib/lp/soyuz/doc/gina.txt
+++ b/lib/lp/soyuz/doc/gina.txt
@@ -109,7 +109,7 @@ And two completely broken packages:
 
 Let's set up the filesystem:
 
-    >>> import subprocess, sys, os
+    >>> import subprocess, os
     >>> try:
     ...     os.unlink("/var/lock/launchpad-gina.lock")
     ... except OSError:
@@ -124,8 +124,7 @@ Let's set up the filesystem:
 
 And give it a spin:
 
-    >>> gina_proc = [sys.executable, 'scripts/gina.py', '-q',
-    ...              'hoary', 'breezy']
+    >>> gina_proc = ['scripts/gina.py', '-q', 'hoary', 'breezy']
     >>> proc = subprocess.Popen(
     ...     gina_proc, stderr=subprocess.PIPE, universal_newlines=True)
 
@@ -528,8 +527,7 @@ packages that failed to import the last time. Overrides should also have
 been updated for packages in breezy which have changed since the last
 run.
 
-    >>> gina_proc = [sys.executable, 'scripts/gina.py', '-q',
-    ...              'hoary', 'breezy']
+    >>> gina_proc = ['scripts/gina.py', '-q', 'hoary', 'breezy']
     >>> proc = subprocess.Popen(
     ...     gina_proc, stderr=subprocess.PIPE, universal_newlines=True)
     >>> print(proc.stderr.read())
@@ -661,7 +659,7 @@ First get a set of existing publishings for both source and binary:
 
 Now run gina to import packages and convert them to partner:
 
-    >>> gina_proc = [sys.executable, 'scripts/gina.py', '-q', 'partner']
+    >>> gina_proc = ['scripts/gina.py', '-q', 'partner']
     >>> proc = subprocess.Popen(
     ...     gina_proc, stderr=subprocess.PIPE, universal_newlines=True)
     >>> proc.wait()
@@ -764,8 +762,7 @@ Commit the changes and run the importer script.
 
     >>> transaction.commit()
 
-    >>> gina_proc = [
-    ...     sys.executable, 'scripts/gina.py', '-q', 'lenny']
+    >>> gina_proc = ['scripts/gina.py', '-q', 'lenny']
     >>> proc = subprocess.Popen(
     ...     gina_proc, stderr=subprocess.PIPE, universal_newlines=True)
     >>> proc.wait()
@@ -803,8 +800,7 @@ Processing multiple suites in the same batch
 Both, 'lenny' and 'hoary' (as partner) will be processed in the same
 batch.
 
-    >>> gina_proc = [
-    ...     sys.executable, 'scripts/gina.py', 'lenny', 'partner']
+    >>> gina_proc = ['scripts/gina.py', 'lenny', 'partner']
     >>> proc = subprocess.Popen(
     ...     gina_proc, stderr=subprocess.PIPE, universal_newlines=True)
 
@@ -825,7 +821,7 @@ Other tests
 
 For kicks, finally, run gina on a configured but incomplete archive:
 
-    >>> gina_proc = [sys.executable, 'scripts/gina.py', '-q', 'bogus']
+    >>> gina_proc = ['scripts/gina.py', '-q', 'bogus']
     >>> proc = subprocess.Popen(
     ...     gina_proc, stderr=subprocess.PIPE, universal_newlines=True)
     >>> print(proc.stderr.read())
diff --git a/lib/lp/soyuz/doc/package-cache-script.txt b/lib/lp/soyuz/doc/package-cache-script.txt
index 8b45e2f..6f75192 100644
--- a/lib/lp/soyuz/doc/package-cache-script.txt
+++ b/lib/lp/soyuz/doc/package-cache-script.txt
@@ -37,8 +37,7 @@ Normal operation produces INFO level information about the
 distribution and respective distroseriess considered in stderr.
 
     >>> import subprocess
-    >>> import sys
-    >>> process = subprocess.Popen([sys.executable, script],
+    >>> process = subprocess.Popen([script],
     ...                            stdout=subprocess.PIPE,
     ...                            stderr=subprocess.PIPE,
     ...                            universal_newlines=True)
diff --git a/lib/lp/soyuz/doc/soyuz-upload.txt b/lib/lp/soyuz/doc/soyuz-upload.txt
index 2b3ff99..475d449 100644
--- a/lib/lp/soyuz/doc/soyuz-upload.txt
+++ b/lib/lp/soyuz/doc/soyuz-upload.txt
@@ -233,7 +233,7 @@ NascentUpload in the 'sync' policy in the future.
 Now we are ready to process the uploaded packages.
 This is done by running process-upload.py on each upload directory.
 
-    >>> import subprocess, sys
+    >>> import subprocess
     >>> script = os.path.join(config.root, "scripts/process-upload.py")
 
 First, we will test process-upload's -J option, which limits which uploads
@@ -243,7 +243,7 @@ just upload number 1.
     >>> upload_dir_1_path = get_upload_dir(1)
     >>> upload_dir_1_name = os.path.basename(upload_dir_1_path)
     >>> process = subprocess.Popen([
-    ...     sys.executable, script, "--no-mails", "-vv",
+    ...     script, "--no-mails", "-vv",
     ...     "-C", "sync", "-J", upload_dir_1_name, temp_dir,
     ...     ],
     ...     stdout=subprocess.PIPE,
@@ -267,7 +267,7 @@ the other three still in incoming.
 Now continue with the real upload.
 
     >>> process = subprocess.Popen([
-    ...     sys.executable, script, "--no-mails", "-vv",
+    ...     script, "--no-mails", "-vv",
     ...     "-C", "sync", temp_dir,
     ...     ],
     ...     stdout=subprocess.PIPE,
@@ -431,8 +431,7 @@ Now we process the accepted queue items, one more time.
 
     >>> transaction.commit()
     >>> script = os.path.join(config.root, "scripts", "process-accepted.py")
-    >>> process = subprocess.Popen(
-    ...     [sys.executable, script, "-d", "ubuntutest", "-q"])
+    >>> process = subprocess.Popen([script, "-d", "ubuntutest", "-q"])
     >>> process.wait()
     0
 
@@ -456,8 +455,7 @@ These packages must now be in the publishing history. Let's check it.
 Invoke Publisher script against the 'ubuntutest' distribution:
 
     >>> script = os.path.join(config.root, "scripts", "publish-distro.py")
-    >>> process = subprocess.Popen([sys.executable, script, "-vvCq",
-    ...                             "-d", "ubuntutest"],
+    >>> process = subprocess.Popen([script, "-vvCq", "-d", "ubuntutest"],
     ...                            stdout=subprocess.PIPE,
     ...                            stderr=subprocess.PIPE,
     ...                            universal_newlines=True)
@@ -556,8 +554,7 @@ Force database changes, so they can be used by the external script properly.
 Invoke Publisher script again to land our changes in the archive
 
     >>> script = os.path.join(config.root, "scripts", "publish-distro.py")
-    >>> process = subprocess.Popen([sys.executable, script, "-vvCq",
-    ...                             "-d", "ubuntutest"],
+    >>> process = subprocess.Popen([script, "-vvCq", "-d", "ubuntutest"],
     ...                            stdout=subprocess.PIPE,
     ...                            stderr=subprocess.PIPE,
     ...                            universal_newlines=True)
diff --git a/lib/lp/soyuz/scripts/tests/test_add_missing_builds.py b/lib/lp/soyuz/scripts/tests/test_add_missing_builds.py
index efcd9a3..9d54629 100644
--- a/lib/lp/soyuz/scripts/tests/test_add_missing_builds.py
+++ b/lib/lp/soyuz/scripts/tests/test_add_missing_builds.py
@@ -5,7 +5,6 @@
 
 import os
 import subprocess
-import sys
 
 from zope.component import getUtility
 
@@ -66,7 +65,7 @@ class TestAddMissingBuilds(TestCaseWithFactory):
             test_args = []
         script = os.path.join(
             config.root, "scripts", "add-missing-builds.py")
-        args = [sys.executable, script]
+        args = [script]
         args.extend(test_args)
         process = subprocess.Popen(
             args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
diff --git a/lib/lp/soyuz/scripts/tests/test_obsoletedistroseries.py b/lib/lp/soyuz/scripts/tests/test_obsoletedistroseries.py
index 87a4a57..92b2ac6 100644
--- a/lib/lp/soyuz/scripts/tests/test_obsoletedistroseries.py
+++ b/lib/lp/soyuz/scripts/tests/test_obsoletedistroseries.py
@@ -5,7 +5,6 @@ __metaclass__ = type
 
 import os
 import subprocess
-import sys
 
 from zope.component import getUtility
 
@@ -44,7 +43,7 @@ class TestObsoleteDistroseriesScript(TestCase):
         script = os.path.join(
             config.root, "scripts", "ftpmaster-tools",
             "obsolete-distroseries.py")
-        args = [sys.executable, script, '-y']
+        args = [script, '-y']
         args.extend(extra_args)
         process = subprocess.Popen(
             args, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
diff --git a/lib/lp/soyuz/scripts/tests/test_populatearchive.py b/lib/lp/soyuz/scripts/tests/test_populatearchive.py
index f30eb4b..97baf62 100644
--- a/lib/lp/soyuz/scripts/tests/test_populatearchive.py
+++ b/lib/lp/soyuz/scripts/tests/test_populatearchive.py
@@ -6,7 +6,6 @@ __metaclass__ = type
 from datetime import datetime
 import os
 import subprocess
-import sys
 import time
 
 from zope.component import getUtility
@@ -70,7 +69,7 @@ class TestPopulateArchiveScript(TestCaseWithFactory):
             extra_args = []
         script = os.path.join(
             config.root, "scripts", "populate-archive.py")
-        args = [sys.executable, script, '-y']
+        args = [script, '-y']
         args.extend(extra_args)
         process = subprocess.Popen(
             args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
diff --git a/lib/lp/translations/doc/poexport-request.txt b/lib/lp/translations/doc/poexport-request.txt
index ac5ed50..ba2b666 100644
--- a/lib/lp/translations/doc/poexport-request.txt
+++ b/lib/lp/translations/doc/poexport-request.txt
@@ -11,10 +11,6 @@ serve those requests properly.
     ...     is_valid_mofile)
     >>> from lp.testing.mail_helpers import pop_notifications, print_emails
 
-This is a dummy logger class to capture the export's log messages.
-
-    >>> import sys
-
 Here's somebody to make a request.
 
     >>> person = factory.makePerson(
@@ -252,7 +248,7 @@ The script is run.
 
     >>> import subprocess
     >>> process = subprocess.Popen([
-    ...     sys.executable, 'cronscripts/rosetta-export-queue.py', '-v'
+    ...     'cronscripts/rosetta-export-queue.py', '-v'
     ...     ], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
     ...     stderr=subprocess.STDOUT, universal_newlines=True,
     ...     )
diff --git a/lib/lp/translations/doc/rosetta-poimport-script.txt b/lib/lp/translations/doc/rosetta-poimport-script.txt
index 680c6a5..58ebb6b 100644
--- a/lib/lp/translations/doc/rosetta-poimport-script.txt
+++ b/lib/lp/translations/doc/rosetta-poimport-script.txt
@@ -78,11 +78,10 @@ Now we run the import script, making sure that the DB user it runs under
 has enough privileges for the script to run to completion.
 
     >>> import os
-    >>> import sys
     >>> import subprocess
     >>> script = os.path.join(config.root, "cronscripts",
     ...                       "rosetta-poimport.py")
-    >>> process = subprocess.Popen([sys.executable, script],
+    >>> process = subprocess.Popen([script],
     ...                            stdout=subprocess.PIPE,
     ...                            stderr=subprocess.PIPE,
     ...                            universal_newlines=True)
diff --git a/lib/lp/translations/doc/sourcepackagerelease-translations.txt b/lib/lp/translations/doc/sourcepackagerelease-translations.txt
index 42459a1..8bf485b 100644
--- a/lib/lp/translations/doc/sourcepackagerelease-translations.txt
+++ b/lib/lp/translations/doc/sourcepackagerelease-translations.txt
@@ -99,9 +99,9 @@ Now, we need to do the final import. It's done as a two steps procedure.
 
 The first one, approves the import.
 
-    >>> import subprocess, sys
+    >>> import subprocess
     >>> process = subprocess.Popen([
-    ...     sys.executable, 'cronscripts/rosetta-approve-imports.py'
+    ...     'cronscripts/rosetta-approve-imports.py'
     ...     ], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
     ...     stderr=subprocess.STDOUT, universal_newlines=True,
     ...     )
@@ -115,9 +115,8 @@ The first one, approves the import.
 
 The second one, executes the import.
 
-    >>> import subprocess, sys
     >>> process = subprocess.Popen([
-    ...     sys.executable, 'cronscripts/rosetta-poimport.py'
+    ...     'cronscripts/rosetta-poimport.py'
     ...     ], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
     ...     stderr=subprocess.STDOUT, universal_newlines=True,
     ...     )