osx - Taking filename input using a mac automator python script -


first off want new python , mac os, program using c++ , using windows.

what trying create drag , drop application plots data in file using python/matplotlib. have created run shell script (shell: /usr/bin/python) app using mac automator , script runs expected if hard code file path. however, change script runs dragging file onto app. code far:

#!/usr/bin/python import sys import matplotlib.pyplot plt # code example online how create main in c++ if __name == "__main__":     main() def main(input, *args, **kwargs):     # if hardcode file name     filename = '/usr/path/to/file/test.txt'     # if try take filename argument dragging/dropping     filename = sys.argv[1:]     open(filename) f:         # code read file , plot 

the error automator giving me:

run shell script failed - 1 error     file "<string>", line 13 

i trying avoid installing external software, managers request, hence why trying use installed automator. need add commands in automator before shell script on handling arguments, or missing completely? may possible using bash script, not know how either


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -