Skip to content Skip to sidebar Skip to footer

Python Checksum Md5 With Argv Called From A Main.py

Is reference with my code to check the md5 from two sources in my link: python saving output from a for iteration and subprocess for checksum I achieve getting md5 respectively. (A

Solution 1:

It looks like you want to call saca_sum_origen with a source and a destination, and right now it just takes 1 argument for the source. The function just needs to be modified to take those arguments:

(I simplified it a bit here)

defsaca_sum_origen(source, dest):
    ck = "md5 %s" % source
    p = subprocess.Popen(ck, stdout=subprocess.PIPE, shell=True)
    (output, err) = p.communicate()
    withopen(dest,'a') as text_file:
    text_file.write(str(output))

Then just replace this line subprocess.call(["./cksum_v2.py", origen, destino]) with cksum_v2.saca_sum_origen(origen, destino)

By the way, it looks like you're trying to make a "shortcut" for a function with this line borrar = os.system('clear'). All this does is assigns the output of os.system('clear'), (which is nothing) to the variable borrar, and then when you're trying to "call" it within your menu code, it's actually not doing anything. If you really want to create an "alias" function, you can make it a function: def borrar: os.system('clear'), and don't forget the parenthesis when you call it: borrar()

Post a Comment for "Python Checksum Md5 With Argv Called From A Main.py"