[script] Execution environment

Date : Tue, 27 Feb 2007 09:51:38 -0500
To : XSI(at)Softimage.COM
From : "Bernard Lebel" <3dbernard(at)gmail.com>
Subject : [script] Execution environment
Hello,

Has anyone found an elegant and/or reliable way of know in what
"environment" is their Python code running?

For instance, if you want to write code that runs both in Python
command line and XSI, you need to know which of them is the code
running, particularly for message printing.

The approach I'm using right now is this:


import win32com

try:
	c = win32com.client.constants
except AttributeError:
	# no "client" attribute when running in shell environment
	sENV = 'shell'
else:
	sENV = 'xsi'
	Application = win32com.client.Dispatch( 'XSI.Application' )
	xsi = Application.application
	...
	


So I'm curious how do other people take care of this.


Thanks Bernard --- Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body: unsubscribe xsi


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.