May-26-2018, 01:43 PM
g_iso = 100 call(["gphoto2","--set-config","iso=%d" % g_iso])The format command (either as
"text with %% %f" % 4.5
or "text with {{} {:f}".format(4.5)
) only works with string (and bytes in python3)If for example you want to write your g_f with 2 decimal places you can use:
print "%.2f" % g_f call(["gphoto2","--set-config","F-Number=%.2f" % g_f])And for the last line:
import os from datetime import datetime name = datetime.now().strftime("%Y_%m_%d_%H_%M_%S.arw") call (["gphoto2","--capture-image-and-download","--filename", os.path.join("/media/pi/6CD8-2DB4/images", name)])One side note, you are using python 2.7 for a new project... I rather recommend to use python3 except if there is no other option. The syntax is more uniform, easier to learn and to work with raw binary data is nicer, once you get used to the bytes type.