S
S
sumi3sew2020-05-20 18:13:47
Python
sumi3sew, 2020-05-20 18:13:47

How to open a file through python script?

There is a python script that was "compiled" into .app for mac
. The script is designed to work with certain files. Now these files that the script works with are opened directly from the script, that is, I drag the file to the console, the path to this file is automatically written in the console and then it opens in the script . How can

I make this file open through the context menu? That is, I click RMB on the file I need, select "open with", select my program. How, then, to pass the path to the file or at least the name to the script?

no data is passed through sys.argv about the file

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2020-05-20
@AlexeyKolodchenko

Make an application in automator that will pass the incoming file as an argument. to a Shell script with a call to your Python script. I only see this option.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question