Timeline for Opening terminal window from python script using applescript and execute a script
Current License: CC BY-SA 4.0
18 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 10, 2022 at 19:48 | comment | added | Robert Kniazidis | All the tilde scripts I provided in the answers work for me on Catalina and have been tested several times. Therefore, it is difficult for me to explain why you have a problem with the tilde. | |
| Dec 10, 2022 at 14:50 | comment | added | kartik mittal | I believe I've resolved the issue, by using absolute path starting from root / and enclosing the complete path in ' ', but the same is not working when using tilde sign ~, can u plz suggest why it is not working with tilde sign? | |
| Dec 9, 2022 at 17:44 | comment | added | Robert Kniazidis | I added temporarly the second, demonstrative answer. | |
| Dec 9, 2022 at 17:23 | comment | added | Robert Kniazidis | I ran python3 ~'/Desktop/untitled folder/test.py' in the Terminal were test.ru is python file which prints triangles. It worked fine. I got the error shown on your screenshots only when provided not correct posix path. So, I say again: run return Posix path of (choose file), copy the part of posix path of result you need, paste into single quotes of shell command, to avoid any strange issues with not correct provided posix path!!! – Robert Kniazidis 7 mins ago Delete | |
| Dec 9, 2022 at 17:20 | comment | added | Robert Kniazidis | Paste here what you get in result when executing Posix path of (choose file), if you don't understand. | |
| Dec 9, 2022 at 14:11 | comment | added | kartik mittal | Screenshots are added in original post above. | |
| Dec 9, 2022 at 7:32 | comment | added | kartik mittal | Both the above observations are double checked and it was not the issue. File name was typo in original question and it is corrected as well to test.py, complete script which I am running is as below which is saved in file 1.py from applescript import tell tell.app( 'Terminal', 'do script "' + "python3 ~'/Desktop/untitled folder/test.py'" + '"') Please also consider my suggestion in previous comment What I think is the error due to missing backslash after "untitled" | |
| Dec 8, 2022 at 15:11 | comment | added | Robert Kniazidis | Also, pay special attention to the fact that the tilde character itself must remain outside the quotes. | |
| Dec 8, 2022 at 14:45 | comment | added | Robert Kniazidis | I can't understand: do you still have file test.ru or tets.ru? Also, are there any extra spaces in the untitled folder name. I recommend that you more carefully check that the Posix path you specify is correct. Run return Posix path of (choose file) to check. | |
| Dec 8, 2022 at 12:36 | comment | added | kartik mittal | New terminal window is opening now with full path to 'test.py' file, but strangely it is showing error "can't open file '~/Desktop/untitled folder/test.py': [Errno 2] No such file or directory". What I think is the error due to missing backslash after "untitled". Please suggest | |
| Dec 7, 2022 at 17:50 | history | edited | Robert Kniazidis | CC BY-SA 4.0 |
added 8 characters in body
|
| Dec 7, 2022 at 17:44 | history | edited | Robert Kniazidis | CC BY-SA 4.0 |
added 416 characters in body
|
| Dec 7, 2022 at 17:28 | history | edited | Robert Kniazidis | CC BY-SA 4.0 |
added 346 characters in body
|
| Dec 7, 2022 at 17:15 | comment | added | Robert Kniazidis | You need the second form, because you use do script as I see. | |
| Dec 7, 2022 at 17:13 | history | undeleted | Robert Kniazidis | ||
| Dec 7, 2022 at 17:12 | history | edited | Robert Kniazidis | CC BY-SA 4.0 |
added 232 characters in body
|
| Dec 7, 2022 at 16:59 | history | deleted | Robert Kniazidis | via Vote | |
| Dec 7, 2022 at 16:55 | history | answered | Robert Kniazidis | CC BY-SA 4.0 |