Can i leave it as it is?

A forum for general discussion of the Python programming language.

Can i leave it as it is?

Postby rsmvdl » Fri May 03, 2013 12:59 pm

Hey guys,

Can i let this script go on humanity?

Code: Select all
import shutil
from tempfile import mktemp
import argparse

parser = argparse.ArgumentParser(description='Handle stuff.')
parser.add_argument('--source', '-s',
                    help='Angabe Quellpfad durch -s oder --source')
parser.add_argument('--destination', '-d',
                    help='Angabe Zielpfad durch -d oder --destination')
args = parser.parse_args()

final_path = mktemp(prefix='tmpisosys', dir=args.destination)
shutil.copytree(args.source, final_path)
User avatar
Posts: 1
Joined: Fri May 03, 2013 12:24 pm

Re: Can i leave it as it is?

Postby setrofim » Sat May 04, 2013 6:29 am

The exit() is redundant (you would use that if you wanted to exit somewhere in the middle of the script). Other than that, looks fine, as far as it goes. You may wish to add some error handling in case the locations don't exist, just so that your users don't have to read through the traceback if that happens.
Posts: 288
Joined: Mon Mar 04, 2013 7:52 pm

Return to General Discussions

Who is online

Users browsing this forum: Google [Bot] and 6 guests