sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #42455
[Question #631918]: rename file with batch command
New question #631918 on Sikuli:
https://answers.launchpad.net/sikuli/+question/631918
I tried to rename an existing file in sikuli using a batch command but get the following error:
TypeError: unsupported operand type(s) for +: 'NoneType' and 'list'
using this code:
import subprocess
from time import gmtime, strftime
now = strftime("%Y-%m-%d_%H:%M:%S", gmtime())
src = "C:\Users\Murph\xxx_yyy_.jpg"
dst = "xxx_yyy_zzz_" + now + "_.jpg"
subprocess.call('ren %s %s'%(src,dst), shell=True)
then I tried a different code and got this error: SyntaxError: ("no viable alternative at input ''%s''",
different code:
import os
os.system(ren '%s','%s' < %(src,dst))
What am I missing?
error code1:
[error] Abgebrochen
[error] Ein Fehler in Zeile 17
[error] Fehlermeldung: Traceback (most recent call last):
File "C:\Users\Murph\AppData\Local\Temp\sikuli-tmp8294784858223312402.py",
line 17, in
subprocess.call('ren %s %s'%(src,dst), shell=True)
File "D:\Program Files (x86)\Sikuli X\sikuli-script.jar\Lib\subprocess.py",
line 456, in call
File "D:\Program Files (x86)\Sikuli X\sikuli-script.jar\Lib\subprocess.py",
line 751, in __init__
File "D:\Program Files (x86)\Sikuli X\sikuli-script.jar\Lib\subprocess.py",
line 1236, in _execute_child
TypeError: unsupported operand type(s) for +: 'NoneType' and 'list'
error code2:
[error] Abgebrochen
[error] Ein Fehler in Zeile 17
[error] Fehlermeldung: Traceback (most recent call last):
File "C:\Users\Murph\AppData\Local\Temp\sikuli-tmp6179560160671230371.py",
line 17, in
os.system('ren %s %s' %(src,dst))
File "D:\Program Files (x86)\Sikuli X\sikuli-script.jar\Lib\subprocess.py",
line 456, in call
File "D:\Program Files (x86)\Sikuli X\sikuli-script.jar\Lib\subprocess.py",
line 751, in __init__
File "D:\Program Files (x86)\Sikuli X\sikuli-script.jar\Lib\subprocess.py",
line 1236, in _execute_child
TypeError: unsupported operand type(s) for +: 'NoneType' and 'list'
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.