How can I check the availablily of an FME license using python?
I want to make sure a license is available before executing a series of arcgis and fme steps.
I think I've seen it somewhere on fmepedia before but I can't find the thread now.
Ken
How can I check the availablily of an FME license using python?
I want to make sure a license is available before executing a series of arcgis and fme steps.
I think I've seen it somewhere on fmepedia before but I can't find the thread now.
Ken
fmeobjects.FMELicenseManager object might help you.
Try this example. -----
# Example of FMELicenseManager (Startup Python Script) import fmeobjects # Create FMELicenseManager object. licMan = fmeobjects.FMELicenseManager() # Print FME license type. print 'FME License Type :', licMan.getLicenseType() # FME license property names.
# See more in your "<FME>/licenses/fme_license.fmelic" file. # <FME>: FME home directory = "C:/Program Files/FME" by default. propNames = N 'REPROJECT', 'BASIC_RASTER', 'PRODUCT NAME', 'EXPIRY DATE', 'LICENSE TYPE', 'LICENSE CATEGORY', ] # Print FME license properties. for name in propNames: prop = licMan.getLicenseProperty(name) if prop: print name, ':', prop
# Destroy FMELicenseManager object.
# It's not necessary in PythonCreator or PythonCaller.
# In Startup / Shutdown?
del licMan -----
About the "del" statement above, we are discussing just now. Follow up this thread. May I use FME Objects in Startup / Shutdown Python Script? http://fmepedia.safe.com/AnswersQuestionDetail?id=906a0000000cq6iAAA I always refer to "FME Object Python API" documentation when writing Python scripts for FME. There isn't this documentation in FMEpedea. It has been installed into your machine if you selected "Install the SDK" when installing FME.
See here. <FME>/fmeobjects/python/apidoc/index.html * <FME>: FME home directory = "C:/Program Files/FME" by default.
Takashi
Is this a stand alone python script?
I want to check the availability of a FME license in a stand along python script and not in a startup or shutdown script in workbench.
On the machine in which FME was installed, you can run the script using not only FME (Startup) but an external Python environment, after installing fmeobjects module into the Python environment.
Assume that you are using FME 2013 on Windows, and Python 2.7 has been already installed in your machine; to install fmeobjects into the external Python 2.7, just copy this dynamic module file
<FME>\\fmeobjects\\python27\\fmeobjects.pyd
to here.
<Python27>\\Lib\\site-packages\\fmeobjects.pyd
<FME> is FME home directory ("C:\\Program Files\\FME" by default), <Python27> is Python 2.7 home directory ("C:\\Python27" by default).
-----
# UsingFMEObjects.py
import sys
sys.path.append("C:\\\\Program Files\\\\FME\\\\fmeobjects\\\\python27")
import fmeobjects
...
-----