mgaitan / fortran_magic

An extension for IPython/Jupyter that helps to use Fortran in your interactive session.
BSD 3-Clause "New" or "Revised" License
117 stars 32 forks source link

fortran_magic on windows #1

Closed mhogg closed 11 years ago

mhogg commented 11 years ago

Hi Martin,

Just tried out fortran_magic in the ipython notebook on windows. Currently doesn't work on windows because the extension for a windows module is '.pyd', not '.so'. Therefore get an error about not being able to find the module. I have modified it on my system as follows to get it working:

    if 'win' in lower(sys.platform): 
        mod_ext = '.pyd'
    else: 
        mod_ext = '.so'
    module_path = os.path.join(lib_dir, module_name + mod_ext)

A similar mod in the master would be appreciated.

Cheers, Mike

mgaitan commented 11 years ago

Thanks Mike, I'll do it in a while.

bfroehle commented 11 years ago

Unfortunately this broke OS X since sys.platform is darwin (which contains win as a substring).

Can we change this to lower(sys.platform).startswith('win') ? See also http://docs.python.org/2/library/sys.html#sys.platform for a list of common sys.platform values.

(To be pedantic, the most appropriate fix here would probably be something similar to how cythonmagic handles this same issue: https://github.com/ipython/ipython/blob/af2a22860a174940e11dfbcd37b42016cbce5b82/IPython/extensions/cythonmagic.py#L281)