Python Forum
Retrieve data from Terminal output or from an ASE variable.
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Retrieve data from Terminal output or from an ASE variable.
#1
This has something to do with both Python and AppleScript so I wasnt sure where to post it, but since python forums are generally much more active, I decided it would be easier on here.

I have a (WIP) python script which will cal some AppleScripts. To sum up what these do - they open Terminal and run some commands. What I want python to do is retrieve the output of the Terminal. I.E if it says "No such file or directory" in Terminal, I could have an if stament saying that if a variable (error for instance) includes the words "No such file or directory" it would do something. The main thing I want out of this convoluted explanation is python to be able to retrieve the output from terminal without using this for instance,
proc = subprocess.Popen(['echo', 'a', 'b'], stdout=tempf)
, where you have to run a command to get the output.

The other way I thought was to somehow get python to retrieve a variable from the AppleScript. In my AppleScript there is a variable which is called 'output_error' and it is just the entire terminal output. If I could somehow get access that variable from python and take the data, then I could use an if statement in a way to see if the string includes "No such file or directory" or whatever.

Thanks in advance,
Dream
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with writing monitored data to mysql upon change of one particular variable donottrackmymetadata 3 281 Apr-18-2024, 09:55 PM
Last Post: deanhystad
Video doing data treatment on a file import-parsing a variable EmBeck87 15 2,892 Apr-17-2023, 06:54 PM
Last Post: EmBeck87
  Python VS Code: using print command twice but not getting output from terminal kdx264 4 1,087 Jan-16-2023, 07:38 PM
Last Post: Skaperen
  Need help on how to include single quotes on data of variable string hani_hms 5 2,033 Jan-10-2023, 11:26 AM
Last Post: codinglearner
  USE string data as a variable NAME rokorps 1 967 Sep-30-2022, 01:08 PM
Last Post: deanhystad
  How to combine two output in one variable? ilknurg 2 1,195 Aug-01-2022, 09:31 AM
Last Post: Gribouillis
  Code to retrieve data from a website charlie13255 0 983 Jul-07-2022, 07:53 PM
Last Post: charlie13255
  Retrieve variable from function labgoggles 2 1,050 Jul-01-2022, 07:23 PM
Last Post: labgoggles
  Os command output in variable shows wrong value paulo79 2 1,514 Apr-09-2022, 03:48 PM
Last Post: ndc85430
  Store variable data and display sum after 60 seconds the_dude 11 3,460 Dec-16-2021, 07:07 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020