Menu

#23 AttributeError: 'Input' object has no attribute 'read':

v1.0_(example)
open
None
1
2019-06-26
2016-07-13
No

Hi all,

I tried follow the example for API phyton in a MacBook of this web site http://www.ahay.org/wiki/Guide_to_madagascar_API

and I have the error:

scons: Reading SConscript files ...
RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9
AttributeError: 'Input' object has no attribute 'read':
File "/Users/diego/Documents/PhD/tesis/experimentos_num/camdas_inclinadas_quali/teste/SConstruct", line 9:
input.read(data)
####################################################

Before, I installed the libraries swig and numpy, following another post in this forum. I'm sure that the libraries was installed, but I dont know whats is the problem.

Thank you,

Diego

Discussion

  • Sergey Fomel

    Sergey Fomel - 2016-08-11

    It looks like the problem is not with Madagascar API but with numpy (the first RuntimeError).

    Please run python and make sure that you can run

    import c_m8r
    import numpy

     
  • Abdullah

    Abdullah - 2016-08-18

    I have the same problem with python API, I am using Ubuntu

    the following code gives an error :

    import numpy, rsf.api

    input = rsf.api.Input('test.rsf')
    n1 = input.int("n1")
    n2 = input.int("n2")

    data = numpy.zeros((n2,n1),'f')
    input.read(data)

    AttributeError: 'Input' object has no attribute 'read':

    it seems that the problem is with c_m8r because when I type

    import c_m8r

    I get this error messege

    ImportError: No module named c_m8r

    How can I resolve this problem?

    Thank you

     
  • Sergey Fomel

    Sergey Fomel - 2016-08-23

    To install c_m8r, you need SWIG http://www.swig.org/

    After installing SWIG, run Madagascar's configure script and make sure that $RSFSRC/config.py has SWIG defined.

     
  • Tushar Gautam

    Tushar Gautam - 2018-06-11

    I installed SWIG using anaconda. It is present in
    /home/seismic5/anaconda2/bin/swig
    I changed SWIG=None to SWIG=['/home/seismic5/anaconda2/bin/swig']
    When I run ./configure it shows SWIG=None again.
    How can I fix this

     
    • Sergey Fomel

      Sergey Fomel - 2019-06-26

      We are trying to figure out how to solve this problem.

      Meanwhile, it should work if you copy or link your installation of SWIG to /usr/bin:

      sudo ln -s /home/seismic5/anaconda2/bin/swig /usr/bin/swig

       
  • Marco D'oleire

    Marco D'oleire - 2019-06-26

    Hi, I have the same problem, I've installed swig, the configuration is done with swig but the problem persist.

     
    • Sergey Fomel

      Sergey Fomel - 2019-06-26

      We are trying to figure out how to solve this problem.

      Meanwhile, it should work if you copy or link your installation of SWIG to /usr/bin:

      sudo ln -s /home/seismic5/anaconda2/bin/swig /usr/bin/swig

       

Log in to post a comment.

MongoDB Logo MongoDB