Python Forum
Showing and saving the output of a python file run through bash
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Showing and saving the output of a python file run through bash
#1
Hi all,

I'm new to the world of Python, linux and programming in general so my question may be very basic but I can't find an answer anywhere.

I'm running a python file (to do a regression so I'm expecting tables as result) on a virtual cluster using a shell file. The job launches and runs fine but I can't visualize the result (print them on prompt) nor create a file with the output.

What could I do to see the results of my python file? Is there a command to put in the bash or in my Python code?

I've already tried a couple of solutions that did not work like putting the following command in the bash python
mycode.py > SomeFile.txt 
This generated an empty txt file named SomeFile.

I also tried adding the following lines in my Python code to get the results in tex and pickle files but it didn't work either:

print(f"Output file: {results.data.htmlFileName}")
results.writeLaTeX()
print(f'LaTeX file: {results.data.latexFileName}')
results.writePickle()
print(f'Pickle file: {results.data.pickleFileName}')
Thank you in advance for any help Smile

PS: To have a better idea of the Python code that I want to run on the cluster I attached the script mycode.py (small clarification: since it is the first code I run so as a test I only ask for 5 Monte Carlo draws but the objective is to ask for 100000 draws or more)

Attached Files

.py   mycode.py (Size: 5.69 KB / Downloads: 241)
Reply


Messages In This Thread
Showing and saving the output of a python file run through bash - by Rim - Oct-04-2021, 07:55 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Problems passing arguments containing spaces to bash script and then on to python kaustin 6 465 Apr-03-2024, 08:26 PM
Last Post: deanhystad
  Reading data from excel file –> process it >>then write to another excel output file Jennifer_Jone 0 1,137 Mar-14-2023, 07:59 PM
Last Post: Jennifer_Jone
  Saving the times a script is run to a file or ... 3Pinter 7 1,442 Oct-19-2022, 05:38 PM
Last Post: 3Pinter
  Code Assistance needed in saving the file MithunT 0 833 Oct-09-2022, 03:50 PM
Last Post: MithunT
  Saving the print result in a text file Calli 8 1,886 Sep-25-2022, 06:38 PM
Last Post: snippsat
  Saving progress in a Python program to use later Led_Zeppelin 9 2,215 Sep-11-2022, 01:32 PM
Last Post: snippsat
  Trying to determine attachment file type before saving off.. cubangt 1 2,189 Feb-23-2022, 07:45 PM
Last Post: cubangt
  saving and loading text from the clipboard with python program MaartenRo 2 1,682 Jan-22-2022, 05:04 AM
Last Post: MaartenRo
  Call a bash script from within a Python programme Pedroski55 6 2,511 Dec-06-2021, 01:53 PM
Last Post: DeaD_EyE
Photo how I write the output into xml file in python? 3lnyn0 1 2,272 Oct-31-2021, 05:40 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

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