<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Stupid Python Trick: print statement revisited</title>
	<atom:link href="http://www.xsi-blog.com/archives/129/feed" rel="self" type="application/rss+xml" />
	<link>http://www.xsi-blog.com/archives/129</link>
	<description>People and thoughts behind XSI in production...</description>
	<pubDate>Tue, 06 Jan 2009 00:46:10 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
		<item>
		<title>By: Denis Barmenkov</title>
		<link>http://www.xsi-blog.com/archives/129#comment-15158</link>
		<dc:creator>Denis Barmenkov</dc:creator>
		<pubDate>Fri, 04 May 2007 10:07:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.xsi-blog.com/?p=129#comment-15158</guid>
		<description>Old good recipe like this was unbuffered stdout and stderr:
http://www.faqts.com/knowledge_base/entry/versions/index.phtml?aid=4419

Also remember that you can restore original handles at any time ("in case they have been overwritten with a broken object" :) ):
sys.stdout=sys.__stdout__
sys.stderr=sys.__stderr__

Regards!</description>
		<content:encoded><![CDATA[<p>Old good recipe like this was unbuffered stdout and stderr:<br />
<a href="http://www.faqts.com/knowledge_base/entry/versions/index.phtml?aid=4419" onclick="javascript:pageTracker._trackPageview('/outbound/comment/www.faqts.com');" rel="nofollow">http://www.faqts.com/knowledge_base/entry/versions/index.phtml?aid=4419</a></p>
<p>Also remember that you can restore original handles at any time (&#8221;in case they have been overwritten with a broken object&#8221; :) ):<br />
sys.stdout=sys.__stdout__<br />
sys.stderr=sys.__stderr__</p>
<p>Regards!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luc-Eric</title>
		<link>http://www.xsi-blog.com/archives/129#comment-15081</link>
		<dc:creator>Luc-Eric</dc:creator>
		<pubDate>Tue, 24 Apr 2007 18:57:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.xsi-blog.com/?p=129#comment-15081</guid>
		<description>Here is a reliable way to tell if you're in XSI or not...

import os
if os.getenv( 'SUMATRAPATH' ) != None : 
	print( "you're in XSI" ) 
else:
	print( "you're not in XSI" )</description>
		<content:encoded><![CDATA[<p>Here is a reliable way to tell if you&#8217;re in XSI or not&#8230;</p>
<p>import os<br />
if os.getenv( &#8216;SUMATRAPATH&#8217; ) != None :<br />
	print( &#8220;you&#8217;re in XSI&#8221; )<br />
else:<br />
	print( &#8220;you&#8217;re not in XSI&#8221; )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bernard Lebel</title>
		<link>http://www.xsi-blog.com/archives/129#comment-14614</link>
		<dc:creator>Bernard Lebel</dc:creator>
		<pubDate>Tue, 27 Feb 2007 14:39:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.xsi-blog.com/?p=129#comment-14614</guid>
		<description>I got a question though.

Have you ever found a reliable way to know in what "environment" you're running the code? I mean, have you found a way for the session to know if it's taking place in command line shell or XSI?


Thanks
Bernard</description>
		<content:encoded><![CDATA[<p>I got a question though.</p>
<p>Have you ever found a reliable way to know in what &#8220;environment&#8221; you&#8217;re running the code? I mean, have you found a way for the session to know if it&#8217;s taking place in command line shell or XSI?</p>
<p>Thanks<br />
Bernard</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bernard Lebel</title>
		<link>http://www.xsi-blog.com/archives/129#comment-14603</link>
		<dc:creator>Bernard Lebel</dc:creator>
		<pubDate>Mon, 26 Feb 2007 14:41:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.xsi-blog.com/?p=129#comment-14603</guid>
		<description>For anyone who's interested in the performance aspect of this, I've run a little test.

I remember when the print statement used to work, without any form of wrapping, that it was a lot faster than LogMessage(). I was really missing that speed.



import time




nTime1 = time.clock()

for i in range(1000):
	print 'something'

nTime2 = time.clock()
nElapsed1 = round( nTime2 - nTime1, 3 )

Application.LogMessage( nElapsed1 )

#INFO: 17.906


------------------------------------------------------------

nTime3 = time.clock()

for i in range(1000):
	Application.LogMessage( 'something' )

nTime4 = time.clock()
nElapsed2 = round( nTime4 - nTime3, 3 )

#INFO: 24.488




Cheers
Bernard</description>
		<content:encoded><![CDATA[<p>For anyone who&#8217;s interested in the performance aspect of this, I&#8217;ve run a little test.</p>
<p>I remember when the print statement used to work, without any form of wrapping, that it was a lot faster than LogMessage(). I was really missing that speed.</p>
<p>import time</p>
<p>nTime1 = time.clock()</p>
<p>for i in range(1000):<br />
	print &#8217;something&#8217;</p>
<p>nTime2 = time.clock()<br />
nElapsed1 = round( nTime2 - nTime1, 3 )</p>
<p>Application.LogMessage( nElapsed1 )</p>
<p>#INFO: 17.906</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>nTime3 = time.clock()</p>
<p>for i in range(1000):<br />
	Application.LogMessage( &#8217;something&#8217; )</p>
<p>nTime4 = time.clock()<br />
nElapsed2 = round( nTime4 - nTime3, 3 )</p>
<p>#INFO: 24.488</p>
<p>Cheers<br />
Bernard</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luc-Eric</title>
		<link>http://www.xsi-blog.com/archives/129#comment-10019</link>
		<dc:creator>Luc-Eric</dc:creator>
		<pubDate>Sat, 23 Dec 2006 22:57:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.xsi-blog.com/?p=129#comment-10019</guid>
		<description>This is gonna help for XSI 6.0, because for many people python''s output went to the history log automatically in XSI 5.1.  

This worked because their version of python was compiled with VC++ 2003 like XSI 5.1, and we re-route automatically the output of the VC++ run-time we use. 

However XSI 6.0 is using the runtime of VC++ 2005 and so this has ceased to work because they are no longer using the same run-time version.

btw I''ve heard Softimage will publish a version of python for XSI on Win64 in the next few weeks...</description>
		<content:encoded><![CDATA[<p>This is gonna help for XSI 6.0, because for many people python&#8217;&#8217;s output went to the history log automatically in XSI 5.1.  </p>
<p>This worked because their version of python was compiled with VC++ 2003 like XSI 5.1, and we re-route automatically the output of the VC++ run-time we use. </p>
<p>However XSI 6.0 is using the runtime of VC++ 2005 and so this has ceased to work because they are no longer using the same run-time version.</p>
<p>btw I&#8221;ve heard Softimage will publish a version of python for XSI on Win64 in the next few weeks&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick Boucher</title>
		<link>http://www.xsi-blog.com/archives/129#comment-9765</link>
		<dc:creator>Patrick Boucher</dc:creator>
		<pubDate>Wed, 20 Dec 2006 22:46:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.xsi-blog.com/?p=129#comment-9765</guid>
		<description>To tell you the truth, I didn''t really think someone would find this useful. I''m happy it helped.

If you figure out how to put this into a module and import it on demand, do post it. I tried and couldn''t get it to work, somehow substituting sys.stdout in the module didn''t affect my main code. Maybe I didn''t wrack my brain enough.</description>
		<content:encoded><![CDATA[<p>To tell you the truth, I didn&#8221;t really think someone would find this useful. I&#8221;m happy it helped.</p>
<p>If you figure out how to put this into a module and import it on demand, do post it. I tried and couldn&#8221;t get it to work, somehow substituting sys.stdout in the module didn&#8221;t affect my main code. Maybe I didn&#8221;t wrack my brain enough.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Meng-Yang Lu</title>
		<link>http://www.xsi-blog.com/archives/129#comment-9763</link>
		<dc:creator>Meng-Yang Lu</dc:creator>
		<pubDate>Wed, 20 Dec 2006 22:16:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.xsi-blog.com/?p=129#comment-9763</guid>
		<description>Niiiiice!  We were just discussing this topic here at work.  And then I see this today.  Yay!  Time saver and makes my code more portable.  Thanks for sharing!

-Lu</description>
		<content:encoded><![CDATA[<p>Niiiiice!  We were just discussing this topic here at work.  And then I see this today.  Yay!  Time saver and makes my code more portable.  Thanks for sharing!</p>
<p>-Lu</p>
]]></content:encoded>
	</item>
</channel>
</rss>
