Daniele Posted February 2, 2021 Posted February 2, 2021 Hello, I have a little script in python that simply check if a file exists. like this: import os def myfunction(): jpg = "Volumes/mydrive/image.jpg" png = "Volumes/mydrive/image.png" if os.path.isfile(jpg): return jpg elif os.path.isfile(png): return png else: return "none" The problem is that, if I call this script from command line works perfectly. But if I launch this same script from a Script Filter in Alfred it always give me "none". What is my mistake? Thanks
deanishe Posted February 2, 2021 Posted February 2, 2021 25 minutes ago, Daniele said: if I call this script from command line works perfectly If you run it in the correct directory, it works. You're using relative paths, so the script looks for “Volumes/...” relative to the working directory. Use “/Volumes/...” with the leading slash.
Daniele Posted February 2, 2021 Author Posted February 2, 2021 Yes! You're totally right. Just fixed and it works perfectly. Thank you
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now