print statements not sent to nohup.out

J

John [H2O]

Just a quick question.. what do I need to do so that my print statements are
caught by nohup??

Yes, I should probably be 'logging'... but hey..

Thanks!
 
J

Jeff McNeil

Just a quick question.. what do I need to do so that my print statements are
caught by nohup??

Yes, I should probably be 'logging'... but hey..

Thanks!

They should be 'out of the box' as nohup is simply going to redirect
standard output. You're probably seeing buffering at work. Are you
including the default newline or are you ending your print statements
with a ',' to suppress? If you're doing the latter, you'll need to
flush sys.stdout or run Python with a '-u' option to disable std(in|
out|err) buffering.
 
J

Jeff McNeil

Just a quick question.. what do I need to do so that my print statements are
caught by nohup??

Yes, I should probably be 'logging'... but hey..

Thanks!

You should get that out of the box. Chances are it's due to
buffering. Are you ending your print statements with a comma? If so,
you'll need to either sys.stdout.flush(), or run python with a '-u'
switch.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top