LoginSignup
ipshiron_deruta
@ipshiron_deruta

Are you sure you want to delete the question?

Leaving a resolved question undeleted may help others!

AutomatorでPythonスクリプト実行

Pythonスクリプトの実行をAutomatorでアプリ化したい

AutomatorでPythonスクリプトを実行してくれるアプリ(みたいなもの)を作りたいと思っています。
ターミナルで
スクリーンショット 2022-07-26 19.01.14.png
を実行すると
スクリーンショット 2022-07-26 19.04.12.png
ちゃんと実行できるのですが、Automatorで同じことをするとスクリーンショット 2022-07-26 19.11.10.png
このようなエラーが起きてしまうのですが、どうしたらいいでしょうか?

0

1Answer

Automator の中ではユーザーの PATH が反映されないので python コマンドが見つからなくてエラーになっていますね。

スクリプトの1行目に #!/usr/bin/env python と書いてあると思いますが、ここを絶対パスに変えれば動くようになります。

ターミナルで which python を実行すると /hoge/fuga/python のように python の絶対パスが出力されます。それを使って #!/hoge/fuga/python のように書き換えてください。

0

Comments

  1. 実行できました!ありがとうございます!!

Your answer might help someone💌