[pydev - Users] pydev and f2py

View: New views
4 Messages — Rating Filter:   Alert me  

[pydev - Users] pydev and f2py

by SourceForge.net :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=5110742
By: xsiebert

Hello folks,

I have an application for which I import *.so modules resulting from the conversion
from *.f fortran code with f2py.
Even though the application find the modules properly, Pydev (1.3.18) flags
an error for every variable/subroutine of these modules.

For example, I have a module fitin.so, and in the python code I do -- given
that the fortran code contains a subroutine called my_subroutine :

import fitin
fitin.my_subroutine()

but Pydev would print this error:

Undefined variable from import : my_subroutine()

Is this clear ? How can I avoid pydev flagging this as an error ?
And yes, the PYTHON PATH contains the path to fitin.so...

Thanks,
--X.



______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=293649

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pydev-users mailing list
Pydev-users@...
https://lists.sourceforge.net/lists/listinfo/pydev-users

[pydev - Users] RE: pydev and f2py

by SourceForge.net :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=5110912
By: fabioz

Are you configuring those to be in the project pythonpath or in the interpreter
pythonpath? Actually, it should work without any special configuration. The
problems on that may be:

1. You're constantly changing the module, so, for each new token you may have
to use ctrl+2 then 'kill' (this will restart the python shell that has been
spawned to make a dir() in the module) -- restarting eclipse would also work
for that.

2. You're running eclipse from a shell that does not have the needed environment
variables so that it can import that dll

Basically, if from the same shell you launched eclipse you're able to start
a python interpreter, import that dll (import fitin) and do a dir(fitin) and
it returns the modules correctly, things should work...

Cheers,

Fabio

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=293649

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pydev-users mailing list
Pydev-users@...
https://lists.sourceforge.net/lists/listinfo/pydev-users

[pydev - Users] RE: pydev and f2py

by SourceForge.net :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=5112992
By: xsiebert

Fabio,

Thanks for your quick response. I still did not resolve the problem though.
Here is some more information, if it helps.

> Are you configuring those to be in the project pythonpath or in the interpreter
pythonpath?
 : I tried both and it does not change anything.


> 1. You're constantly changing the module, so, for each new token you may have
to use ctrl+2 then 'kill' (this will restart the python shell that has been
spawned to make a dir() in the module) -- restarting > eclipse would also work
for that.

: the module does not change. restarting eclipse does not help.

> 2. You're running eclipse from a shell that does not have the needed environment
variables so that it can import that dll
> Basically, if from the same shell you launched eclipse you're able to start
a python interpreter,
> import that dll (import fitin) and do a dir(fitin) and it returns the modules
correctly, things should work...

: in the shell from which I start eclipse I can launch the python interpreter,
do import fitin and dir(fitin) shows all what it should :

>>> import fitin
>>> dir(fitin)
['__doc__', '__file__', '__name__', '__version__', 'abrax', 'angkte',
'as_column_major_storage', 'cacao', 'cao', 'celdaez', 'cellez', 'cierre', 'corbyres',
'correl', 'dette', 'dimen', 'dimico', 'fitcorbyres', 'fitcorrel', 'fitin',
'fitswitch', 'fixmol', 'fsym', 'has_column_major_storage', 'iamin', 'initt',
'interpol', 'ioprg', 'lecfoq', 'lectab', 'maxou', 'ncsdat1', 'ncsdat2', 'ncsym',
'ortem', 'ortm', 'pro2mx', 'readalgo', 'redim', 'reso', 'rmx2e', 'rmx2p', 'rmxe',
'rmxp', 'rotra', 'rotran', 'starez', 'tables']

But in eclipse any of the fitin subroutines shows as "unresolved variable from
import".

to try to figure out what happened, I created a new project directory and moved
all my files in there.
Strangely, at first it shows an error "unresolved import : fitin". When I clicked
on the error to make the text editor jump to it, this error disappeared but
turned into a bunch of "unresolved variable from import" for each subroutine
from the fitin module...
However, I can run the application from Eclipse, and I can even see the fitin
variables/subroutines in the debugger, and they show up in the console if I
add print dir(fitin) at the line where the error appears !

I should have said I am running eclipse 3.2.2-5  (i.e. the latest package available
for linux debian AFAIK). I saw another post today about the compatibility between
eclipse 3.2 and pydev...
Could this cause the problem ?

Thanks,
--X.
 


______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=293649

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pydev-users mailing list
Pydev-users@...
https://lists.sourceforge.net/lists/listinfo/pydev-users

[pydev - Users] RE: pydev and f2py [SOLVED]

by SourceForge.net :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=5120615
By: xsiebert

Hello,

I think I found out where the problem was.
The error occurs because I do something like this:
try:
   import fitin
except ImportError:
   try:
     import fitin2 as fitin
   except ImportError:
     print "Error importing fitin module"

[the reason I do this "dirty" trick is that depending on the numpy version either
fitin.so or fitin2.so can be imported...]

It does not occur however if I do simply:
try:
    import fitin
except ImportError:
    print "Error importing fitin module"


Well, sorry I bothered you guys.
--X.
   

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=293649

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pydev-users mailing list
Pydev-users@...
https://lists.sourceforge.net/lists/listinfo/pydev-users
LightInTheBox - Buy quality products at wholesale price