Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have found a temporary solution to this problem, but it is not optimal. I will continue to work through the f2py source so that I can better understand it and fix the problem within the code itself. Until then, this is my solution which was inspired by <a href="https://github.com/numpy/numpy/issues/3562#issuecomment-24469055">chatcannon's comment to the issue I posted to nympy's github</a>.</p> <p>There are several ways to approach this problem from a temporary standpoint including a couple of ways of modifying the .pyf files. I don't want to have to modify the .pyf files as it becomes very cumbersome as part of a larger package. To avoid this, I added f2py directives to my f90 source.</p> <p>Taking the example from my original question:</p> <pre><code>MODULE test INTEGER, PARAMETER :: a = 1 END MODULE test MODULE test2 USE test INTEGER, PARAMETER :: b = 2 END MODULE test2 </code></pre> <p>simply add an f2py directive in test2 to show f2py how to define <code>test2.a</code>:</p> <pre><code>MODULE test INTEGER, PARAMETER :: a = 1 END MODULE test MODULE test2 USE test !f2py integer, parameter :: a ! THIS EXPOSES `a` in `test2` INTEGER, PARAMETER :: b = 2 END MODULE test2 </code></pre> <p>Importing from the resulting <code>test.so</code> correctly exposes <code>test2.a</code>:</p> <pre><code>In [1]: import test In [2]: print test.test.a 1 In [3]: print test.test.b --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) .../test_solution/&lt;ipython-input-3-798b14f59815&gt; in &lt;module&gt;() ----&gt; 1 print test.test.b AttributeError: b In [4]: print test.test2.a 1 In [5]: print test.test2.b 2 </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload