[Pydev-users] Python program running twice
Brought to you by:
fabioz
|
From: Gary R. <gar...@ve...> - 2016-02-14 23:25:02
|
I've had several occasions when a python program seems to loop through
twice. Below is an example:
from os import walk
import subprocess
f = []
x = ""
for (dirpath, dirnames, filenames) in walk('.'):
f.extend(filenames)
f.sort()
for x in f:
if x[-3:]=='JPG':
print(x)
args = "convert " + x + " -rotate " + "-90 " + x
subprocess.call(args, shell=True)
This program should rotate a jpg file by 90 degrees left. It actually
rotates the file 180 degrees and the print(x) function prints the file
name twice. What am I doming wrong.
I run it as python rotate.py from the command line.
Gary R.
|