Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print statements giving Invalid Syntax error [duplicate]

Tags:

python

this seems to be a little strange. I am having some print statements in my python script which I run via Batch job.

The problem is with the print statements I tried every thing possible but its still throwing a Invalid Syntax error.

print STDERR 'Kapil >> BEFORE INSERT';
print STDERR 'Kapil tag_id >> $tag_id';
print STDERR 'Kapil Hostname >> $hostname';

I have to give STDERR to print the statements in job out file. Otherwise nothing is getting printed.

  File "/d/home/aprun-prologue/aprun-prologue", line 169
    print STDERR 'Kapil >> BEFORE INSERT \n';
                                           ^
SyntaxError: invalid syntax

Thanks, Kapil

like image 383
kay Avatar asked Mar 22 '26 20:03

kay


1 Answers

import sys

print >>sys.stderr, 'Kapil >> BEFORE INSERT'
print >>sys.stderr, 'Kapil tag_id >> $tag_id'
print >>sys.stderr, 'Kapil Hostname >> $hostname'
like image 75
John Kugelman Avatar answered Mar 24 '26 09:03

John Kugelman