[Ifeffit] Scripting - Python

Andrew Korinda a-korinda at northwestern.edu
Thu Jul 14 21:43:04 CDT 2011


So I went through and double checked the use_ifeffit, no change. I
then entered the bin path directly and tried again, again with the
same results. Following your code, I just have one difference when I
import Ifeffit:
"Forcing DISTUTILS_USE_SDK=1"
Do I need to install a version of Visual Studio?

The full text from the command shell is attached to spare others
following this including an output of my paths.

Andy K.

On Thu, Jul 14, 2011 at 12:50 PM, Matt Newville
<newville at cars.uchicago.edu> wrote:
> Hi Andrew,
>
> Just as a follow-up, loading the Ifeffit library from python worked
> for me on a separate Win7 machine (64bit).  I even had Ifeffit
> installed to the non-default location. With Ifeffit installed to
> C:\apps\Ifeffit, I edited C:\apps\Ifeffit\bin\use_ifeffit.bat to read
>
>   @echo off
>   SET IFEFFIT_DIR=C:\apps\Ifeffit\
>   SET IFEFFIT_BIN=C:\apps\Ifeffit\bin
>   SET PATH=%PATH%;%IFEFFIT_BIN%
>   SET PGPLOT_DIR=%IFEFFIT_BIN%
>   SET PGPLOT_DEV=/GW
>
> Then from a command prompt:
>    C:\>C:\apps\Ifeffit\bin\use_ifeffit
>    C:\>python
>    Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32
> bit (Intel)] on win32
>    Type "help", "copyright", "credits" or "license" for more information.
>    >>> import Ifeffit
>    >>> x  = Ifeffit.Ifeffit()
>    >>> x.ifeffit('show $&build')
>     $&build        = 1.2.11c Copyright (c) 2008 Matt Newville, Univ of Chicago
>
> Does that work for you?  If not, can you send a more complete report
> of your environmental variables?
>
> Sorry for the trouble,
>
> --Matt
>
> On Thu, Jul 14, 2011 at 9:58 AM, Andrew Korinda
> <a-korinda at northwestern.edu> wrote:
>> Thanks Matt. That new binary was a great help. The install appears to
>> have gone fine. I made the appropriate path changes in
>> use_ifeffit.bat, ifeffit_config.py and ifeffit.py to reflect where I
>> have installed Ifeffit. I noticed this when I was trying to debug an
>> import error I get when I call ifeffit but this didn't solve the
>> problem. The error I am getting is: ('failed to load ifeffit library
>> ', 'C:\\Program Files (x86)\\Ifeffit\\bin\\ifeffit_12.dll') which is
>> fatal. It's from line 125 of ifeffit.py. I've double check and the dll
>> is there so I'm not sure why it is failing.
>>
>> I saw Joel.Brugger had the same issue on his Mac but I didn't see an
>> email about that being resolved. Matt or anyone have another
>> suggestion where I can look to debug this?
>>
>> Andy K.
>>
>> On Wed, Jul 13, 2011 at 2:53 PM, Matt Newville
>> <newville at cars.uchicago.edu> wrote:
>>> Hi Andrew,
>>>
>>> Sorry for not keeping these more up-to-date.  I posted windows
>>> installers for Python 2.6 and Python 2.7 (sorry, no Python 3 support
>>> yet) at
>>>   http://cars.uchicago.edu/~ifeffit/src/PythonWrapper/
>>>
>>> I'll update the links on the wiki.
>>>
>>> Note that to use these well (especially for plotting fonts and colors
>>> to work), you may have to run C:\Program
>>> Files\Ifeffit\bin\use_ifeffit.bat, or otherwise set the environmental
>>> variables given in that file.
>>>
>>> Cheers,
>>>
>>> --Matt
>>>
>>>
>>> On Wed, Jul 13, 2011 at 10:41 AM, Andrew Korinda
>>> <a-korinda at northwestern.edu> wrote:
>>>> After a reprieve from XAS work, I'm back at it with a new laptop. In
>>>> rebuilding the Ifeffit python package I realized I did not properly
>>>> compile all the instructions which would explain why I wasn't getting
>>>> things to return to the python shell such as echo messages. I am
>>>> currently trying to properly install the Ifeffit wrapper from within
>>>> ifeffit-1.2.11c.tar.gz onto Windows 7 and Python 2.7.2. Of course this
>>>> has required some tweaks but when I get to "gcc.exe -mno-cygwin
>>>> -shared -s build" the install crashes. I believe this has to do with
>>>> site_install.py being writing for redhat and I'm not sure how to
>>>> modify the directories for windows.
>>>>
>>>> Is there a way around this? I realize I could go back and install
>>>> Python 2.5 and run Ifeffit-1.2.win32-py2.5.exe but that does mean
>>>> going back and reinstalling every package (numpy, scipy, matplotlib,
>>>> etc.) Is there maybe a way to rework Ifeffit-1.2.win32-py2.5.exe so it
>>>> can be used on a machine with Python 2.7.2?
>>>>
>>>> Andy Korinda
>>>>
>>>> On Mon, Nov 8, 2010 at 12:36 AM, Andrew Korinda
>>>> <a-korinda at northwestern.edu> wrote:
>>>>> Thanks for the help. Sorry it took so long to report back but I can only do
>>>>> must of my work on this on weekends. The corrected code worked great and I'm
>>>>> moving forward again. No message was given when the code wasn't working.
>>>>>
>>>>> Andy Korinda
>>>>>
>>>>> On Nov 1, 2010 1:55 PM, "Matt Newville" <newville at cars.uchicago.edu> wrote:
>>>>>
>>>>> Hi Andrew,
>>>>>
>>>>> On Mon, Nov 1, 2010 at 12:01 PM, Andrew Korinda
>>>>> <a-korinda at northwestern.edu> wrote:
>>>>>> I'm looking t...
>>>>>
>>>>> This is almost certainly due to space in the filename, and is really
>>>>> more of a problem with the fortran than python (or perl for that
>>>>> matter).  That is, with a space in the file name, you should
>>>>> explicitly use
>>>>>    read_data(file=...., group=...)
>>>>>
>>>>> This should work better::
>>>>>    import Ifeffit
>>>>>    iff = Ifeffit.Ifeffit()
>>>>>
>>>>>    ret = iff.ifeffit("read_data(file=C:\Program
>>>>> Files\Ifeffit\examples\Ifeffit\data\cu.xmu, group=c)")
>>>>>
>>>>> If it doesn't, let use know.
>>>>>
>>>>>> >From this experience I have some questions:
>>>>>>
>>>>>> ~First does anyone have some debugging tips for ...
>>>>>
>>>>> There should have been a printed message that might have altered you
>>>>> that the file hadn't been read in correctly:
>>>>>   *** read_data: no file name given!
>>>>>
>>>>> was that message not given?
>>>>>
>>>>>> ~Secondly, Does anyone have any example Python scripts for Ifeffit
>>>>>> that they would like to shar...
>>>>>
>>>>> I sort of deliberately have left the base Ifeffit python module
>>>>> bare-bones.  It would certainly be possible to add more functionality
>>>>> to that, or distribute add-on packages.  It sort of depends what
>>>>> people would find desirable.
>>>>>
>>>>> I have many example scripts using Ifeffit + Python, mostly scripts,
>>>>> not documented, reliable code.  Of course, there is also sixpack.  I
>>>>> had some older GUIs as well.  Would it be helpful to add some small
>>>>> examples on a wiki page?
>>>>>
>>>>>> ~Finally, would I be better off coding in Perl and using Demeter?
>>>>>
>>>>> That's a difficult question.  The relative merits of Perl v Python are
>>>>> sort of a topic all on their own.  For what it's worth, I believe
>>>>> (far) more people have used Python than Perl, but several very notable
>>>>> Ifeffit programs are written in Perl ;).
>>>>>
>>>>> --Matt
>>>>>
>>>>> PS: The next version of Ifeffit will be in python.   Progress is slow,
>>>>> and when it will start to look like an EXAFS analysis program is a
>>>>> fair question.  It probably shouldn't sway your decision much.
>>>>>
>>>>> _______________________________________________
>>>>> Ifeffit mailing list
>>>>> Ifeffit at millenia.cars.aps.anl.g...
>>>>
>>>> _______________________________________________
>>>> Ifeffit mailing list
>>>> Ifeffit at millenia.cars.aps.anl.gov
>>>> http://millenia.cars.aps.anl.gov/mailman/listinfo/ifeffit
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Ifeffit mailing list
>>> Ifeffit at millenia.cars.aps.anl.gov
>>> http://millenia.cars.aps.anl.gov/mailman/listinfo/ifeffit
>>>
>>
>> _______________________________________________
>> Ifeffit mailing list
>> Ifeffit at millenia.cars.aps.anl.gov
>> http://millenia.cars.aps.anl.gov/mailman/listinfo/ifeffit
>>
>>
>
> _______________________________________________
> Ifeffit mailing list
> Ifeffit at millenia.cars.aps.anl.gov
> http://millenia.cars.aps.anl.gov/mailman/listinfo/ifeffit
>
-------------- next part --------------
C:\Program Files (x86)\Ifeffit\bin>use_ifeffit

C:\Program Files (x86)\Ifeffit\bin>cd\

C:\>python
Enthought Python Distribution -- www.enthought.com
Version: 7.1-1 (64-bit)

Python 2.7.2 |EPD 7.1-1 (64-bit)| (default, Jul  3 2011, 15:34:33) [MSC v.1500 6
4 bit (AMD64)] on win32
Type "packages", "demo" or "enthought" for more information.
>>> import Ifeffit
Forcing DISTUTILS_USE_SDK=1
>>> x = Ifeffit.Ifeffit()
('failed to load ifeffit library ', 'C:\\Program Files (x86)\\Ifeffit\\bin\\ifef
fit_12.dll')
C:\Program Files (x86)\Ifeffit\bin;C:\Python27\Lib\site-packages\PyQt4;C:\Progra
m Files (x86)\Intel\ComposerXE-2011\redist\intel64\mkl;C:\Program Files\Common F
iles\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft
 Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\
Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Common Files\Len
ovo;C:\Program Files (x86)\Common Files\Ulead Systems\MPEG;C:\Program Files (x86
)\Windows Live\Shared;C:\SWTOOLS\ReadyApps;C:\Program Files (x86)\Intel\Services
\IPT\;C:\Program Files (x86)\Lenovo\Access Connections\;C:\Python27;C:\MinGW\bin
;C:\Python27\Scripts;C:\Program Files\MySQL\MySQL Server 5.5\bin;C:\Program File
s (x86)\Ifeffit\bin;C:\Program Files (x86)\Ifeffit\;C:\Program Files (x86)\SSH C
ommunications Security\SSH Secure Shell;C:\Users\Andy K;C:\Program Files (x86)\I
feffit\bin;C:\Program Files (x86)\Ifeffit\bin
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\Ifeffit\ifeffit.py", line 127, in __init__

    raise ImportError('Cannot load ifeffit library')
ImportError: Cannot load ifeffit library
>>> exit()

C:\>path
PATH=C:\Python27\Lib\site-packages\PyQt4;C:\Program Files (x86)\Intel\ComposerXE
-2011\redist\intel64\mkl;C:\Program Files\Common Files\Microsoft Shared\Windows
Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Window
s\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerS
hell\v1.0\;C:\Program Files (x86)\Common Files\Lenovo;C:\Program Files (x86)\Com
mon Files\Ulead Systems\MPEG;C:\Program Files (x86)\Windows Live\Shared;C:\SWTOO
LS\ReadyApps;C:\Program Files (x86)\Intel\Services\IPT\;C:\Program Files (x86)\L
enovo\Access Connections\;C:\Python27;C:\MinGW\bin;C:\Python27\Scripts;C:\Progra
m Files\MySQL\MySQL Server 5.5\bin;C:\Program Files (x86)\Ifeffit\bin;C:\Program
 Files (x86)\Ifeffit\;C:\Program Files (x86)\SSH Communications Security\SSH Sec
ure Shell;C:\Users\Andy K;C:\Program Files (x86)\Ifeffit\bin;C:\Program Files (x
86)\Ifeffit\bin

C:\>


More information about the Ifeffit mailing list