[Thread Prev][Thread Next][Index]

Re: [ferret_users] installation problem with pyferret



Dear Hein,
 
a tip for anyone trying to use the pyferret module from python:
when trying to follow the tutorial for calling ferret from python,
note that setting PYTHONPATH is not enough: you also need to set
LD_LIBRARY_PATH to include
$FER_DIR/lib/python2.7/site-packages/pyferret .

If you don't, ferret will complain that it cannot load
$FER_LIBS/ferret_ef_mem_subsc.so when called from a pure python
script.  Everything works fine when calling ferret with the pyferret
script, as it sets LD_LIBRARY_PATH for you.

Perhaps it's worth updating the manual with this information.

Yes, this would be good to add to the documentation.  I working to get a long-overdue new release of pyferret out this summer.  There will be a number of updates needed for the documentation.  Some of the fixes and enhancements in the next release are mentioned in the comments of known issues listed here:
http://ferret.pmel.noaa.gov/static/Downloads/pyferret_known_issues_addenda.html
(I recently updated this page.)  Not everything mentioned there will be fixed or added in the next release, however.
 
I also have a question: what is the difference between
pyferret.start() and pyferret.init()?  When I call pyferret.init() I
get an error:


> Python 2.7.3 (default, Aug  1 2012, 05:14:39)
> [GCC 4.6.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import pyferret
>     WARNING: Unable to import cdms2 and/or cdtime;
>              the Python functions pyferret.get and pyferret.put are not available
> >>> pyferret.init()
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/net/nas/data/applications/ferret/pyferret-6.8.2/64/lib/python2.7/site-packages/pyferret/__init__.py", line 136, in init
>     if not '-secure' in arglist:
> TypeError: argument of type 'NoneType' is not iterable

The pyferret.init method takes a list of command-line arguments and then calls pyferret.start with values appropriate for those command-line arguments.  So this method is expecting to be given a list.  Unfortunately, I made the default for that argument (what it uses if you do not give it an argument) None instead of [] (an empty list), but then did not properly handle this case.  So just call the function with an empty list: pyferret.init([])  This also has been fixed in the next release.

The pyferret.init method also loads all the standard external functions written in Python.  So, in general, you probably do want to use the pyferret.init method instead of the pyferret.start method.

Karl

--
Karl M. Smith, Ph.D.
JISAO Univ. Wash. and TMAP/PMEL NOAA
"The contents of this message are mine personally and do
not necessarily reflect any position of the Government
or the National Oceanic and Atmospheric Administration."

[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement