fortpy
fortpy copied to clipboard
AttributeError:('UserContext' object has no attribute 'module')
Hi, I am trying to run fortpy on a python3-based system (arch linux). However, it seems I can make it work. I have customized the fortpy package using
'(fortpy-environment-virtualenv
(quote
("virtualenv" "--system-site-packages" "--quiet" "--python=/usr/bin/python2")))
Whenever I type something in a fortran buffer, I get the error AttributeError:('UserContext' object has no attribute 'module')
. It seems I'm the only one having this problem, so I have probably missed some important point.
Hi,
sorry that I haven't responded before now; I was super busy getting ready for a trip and just got back a week ago. The fact that you are getting such a specific error message means that the customization of your virtualenv
is not what's causing the problem. It seems that emacs is talking to the python backend just fine, but the backend is having a hard time returning anything useful.
Were you working on a fortran file for a program or a module?
Hi, sure don't worry! I was working on a Fortran module, even though I don't think it's actually working on a Fortran program neither.
Could you send me the module file? Then I can add it to my unit tests once the problem is fixed. My email is [email protected] I can also just use it to debug and then delete it if the code is sensitive. You could also obfuscate it if necessary. On May 14, 2016 13:33, "Corentin Cadiou" [email protected] wrote:
Hi, sure don't worry! I was working on a Fortran module, even though I don't think it's actually working on a Fortran program neither.
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/rosenbrockc/fortpy/issues/81#issuecomment-219238949
Hi, so I double checked my previous post: it seems to work on fortran modules, but not on fortran program.
You can find the code I'm working on at https://github.com/cphyc/cosmo_z17to0. The file I've tested (and that doesn't work) is find_particles_in_region.f90. If I try to get the doc of a function (say tools/compute.f90:compute_inertia_tensor) using fortpy-show-doc
, I get the error AttributeError:('UserContext' object has no attribute 'module')
.
Hi,
something that might relevant to you is the fact the the submodule I'm importing in the main program of find_particles_in_region.f90
are not in the same folder as the program, but in a folder named tools
.
Isn't the problem simply a problem of not finding the relevant file?
I am able to reproduce the error, even with the code in the same directory. However, if you are working with a whole library, you should really consider setting up a global configuration file that has all the code directories in it so that fortpy
can find them all. See global configuration for details. You basically just need a
<codes>
<trunk name="uncle" value="~/codes/uncle/src" />
<trunk name="celib" value="~/codes/symlib/src" />
<trunk name="enumlib" value="~/codes/enumlib/src" />
</codes>
in the global configuration file with all the paths to your various folders. Then just add export FORTPY_CONFIG="~/path/to/config.xml"
to your bash profile.
I'll keep you updated on the isense problem.
This is related to #12; I am working on an implementation, but it could be a while. It isn't technically complicated, but I have to think through the differences between module and program structure as it relates to the isense.
Hi! Is there any update?