rename file with batch command
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(
src = "C:\Users\
dst = "xxx_yyy_zzz_" + now + "_.jpg"
subprocess.
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\
line 17, in
subprocess.
File "D:\Program Files (x86)\Sikuli X\sikuli-
line 456, in call
File "D:\Program Files (x86)\Sikuli X\sikuli-
line 751, in __init__
File "D:\Program Files (x86)\Sikuli X\sikuli-
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\
line 17, in
os.system('ren %s %s' %(src,dst))
File "D:\Program Files (x86)\Sikuli X\sikuli-
line 456, in call
File "D:\Program Files (x86)\Sikuli X\sikuli-
line 751, in __init__
File "D:\Program Files (x86)\Sikuli X\sikuli-
line 1236, in _execute_child
TypeError: unsupported operand type(s) for +: 'NoneType' and 'list'
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- SikuliX Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Thomas T. Tran for more information if necessary.