How to handle the File hand-off from windows in a python program -


i want set python program process pdfs opened on system, , hand processed pdf off standard reader.

so register program windows default handler .pdf files , windows presumably run program on pdf file.

how within script access file. file name 1 sys.argvs?

i didn't google work me here.

so, yes, windows passes file name script 1 of sys.argvs. (so far can tell printing value) file name without path, used open file, tells me windows starts program working directory set directory of file it's called on.

one word of caution, gotcha of sorts, registering .py default handler, did not work -- clicking on file, resulted in windows complaining file not valid windows executable. didn't research turned .py .exe (py2exe) , registered that default file handler did work.

update, did not test out told specifying python interpreter script default file handler solve "not valid" issue. "c:\python2.7\python.exe yourscript.py %*" %* make file name made available script. (adding without testing because on 1 hand problem has been solved , on other told makes sense me)


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -