hansec / autocomplete-fortran

https://atom.io/packages/autocomplete-fortran
MIT License
16 stars 0 forks source link

Error parsing file #5

Closed pedro-tanure-veloso closed 7 years ago

pedro-tanure-veloso commented 7 years ago

Hi,

While writing my Fortran code, I keep getting "Error parsing file (...)" and "Script failed" underneath. This happens in every single word I type. What am I doing wrong?

hansec commented 7 years ago

Well that certainly shouldn't happen... Please try parsing the file in debug mode and post the output below. Also, what OS are you using?

pedro-tanure-veloso commented 7 years ago

I'm sorry, I'm having issues entering the debug mode. Should I run the code provided in the link in the command prompt (I'm using Windows)? If so, I'm getting an error message like the one below: error

hansec commented 7 years ago

What version of python are you using?

hansec commented 7 years ago

Ok, I think you are probably using Python3 which I never tested this with. Can you try the updated parsing script in the py3_printFix branch and let me know if that works?

Foadsf commented 7 years ago

I also have the exact same issue working on fortran code:

screen shot 2016-12-03 at 15 05 18

I checked my python version with pyhton -V and I'm using Python 2.7.12 although I think python 3 is installed for some other projects I have been working on. I saw your suggestion above to use an updated branch, but unfortunately I don't know how should I install this experimental branch. should I download/clone it and then install it with python or nod.js? I would appreciate if you could provide the dummy instructions. I also found this and this stackoverflow posts which sugest that there emight be some issue with the sufixes. it appears that when the code version is not what plugin expects from the sufix the error happens.

edit(1): I uninstalled and reinstalled the pluging and ti come up with a new type of error. now it gives me a report:

screen shot 2016-12-03 at 15 53 25
{
  "core": {
    "disabledPackages": [
      "linter-scspell",
      "symbols-view"
    ],
    "telemetryConsent": "no",
    "themes": [
      "atom-dark-ui",
      "one-dark-syntax"
    ]
  },
  "autocomplete-fortran": {
    "pythonPath": "/Users/foadsf/.atom/packages/autocomplete-fortran/python/parse_fortran.py"
  }
}

I tried the button create issue on the autocomplete-fortran package but I got this error in my browser: 414 Request-URI Too Large nginx

screen shot 2016-12-03 at 15 55 06

P.S. besides, unfortunately there is no feature request feature in github :)) so I mention it here there are several great old projects developed by Netlib (formerly Bell Laboratories) and other companies/research groups, which worth being revived and used. here are some I found interesting:

  1. FTNCHEK
  2. floppy
  3. f90ppr
  4. fpt
  5. fortrancheckIDE
  6. Cleanscape FortranLint
  7. findent

it would be a great idea if you could integrate them into this plugin or having the experience glue them to Atom with other plugins

hansec commented 7 years ago

@Foadsf when you run the parsing script from the command line in debug mode do you get the same Python syntax errors on print statements as above?

Foadsf commented 7 years ago

no when I run the command I just get a report assessing my code which seems logical. no errors

hansec commented 7 years ago

@Foadsf Ok, your issue is different from this one. It looks like your python path (in the settings for autocomplete-fortran) is set to the parsing script when it should point to your desired python executable. On OS X you should be able to use the default path /usr/bin/python. If that change doesn't work please create a new issue with the error you get after making that change. Make sure you close and reopen Atom after changing the path in settings.

Foadsf commented 7 years ago

ok, I think I just figured the issue out. first of all sorry for messing up with the default address. had made mistake putting the parsing script instead of the python itself. I had my python installed using homebrew and it was in /Library/Frameworks/Python.framework/Versions/2.7/bin/python not in the default folder. I could find it using the command which python so by putting the right folder I'm not getting the error anymore. I tried a couple of files and no error seen.

Yaphet-Chen commented 7 years ago

Hi, I have the same issue as @ptanure had. My OS is window 10, the version of Python is 2.7(the same as Python 3.5). I also meet some problems when entering debug mode in cmd.

1485261403 1

qq 20170124204005

What weird is that I will get the same syntax error if I copy the parse_fortran.py to D disk.

qq 20170124214340

So I wonder if the problem is caused by the path? Since it contains space or point?

hansec commented 7 years ago

@Yaphet-Chen I just updated things to fix the issue when using Python 3. Try updating the extension and let me know if that fixes things.

As for the path error you get when debugging, it looks like you have the "autocomplete-fortran\python" part of the parser path accidentally repeated (at least it is in the first screenshot).

Yaphet-Chen commented 7 years ago

@hansec Sorry for the error path I entered previously. I have updated the autocomplete-fortran package, but it seems that the issue still exists. Currently, all my packages in the atom are up to date.

_b2up vgis 8cl s jupt6

My Python's version is 3.5.3 and the Python 2 has been uninstalled fully qq 20170125145136

Bellow is the message in debug mode o1 jjocz5 _k 4x4gvrvg m

packages installed 5s de4 9c9eo a f gjn2f1

python excutable path vh2d8isk5o4 4 26irlye9

Thank you very much for your efforts.

hansec commented 7 years ago

Ok, can you check to make sure that Atom is finding your Python executable? After you get the error open the javascript console in the Atom menu "View -> Developer -> Toggle Developer Tools". A pane will open with the developer tools and the Console tab should be selected by default. There should be some output there. If you see something like "... is not recognized as an internal or external command ..." then the Python path is not working. The path you specify needs to be the full path to the Python executable not the containing folder.

If you see something else let me know.

Yaphet-Chen commented 7 years ago

There are some errors I got indeed. However, instead of "... is not recognized as an internal or external command ...", it showed up as some messy codes. qq 20170126134344

fortran-provider.coffee:204 qq 20170126134403

fortran-provider.coffee:249 qq 20170126134408

I believe the path I specified is the full path to the Python executable. qq 20170126140614 qq 20170126140825

Thank you!

hansec commented 7 years ago

Hmmmm, I think the random symbols is an issue with language support. I still think the error is a path issue though. You are only specifying the path to the containing folder. You need to add \python.exe onto the end to provide the full path to the actual executable.

Yaphet-Chen commented 7 years ago

Hmmm, it does the issue of the path. After I add \python.exe onto the end of my previous path, all the errors fixed! :bowtie: Thank you so much!!!

hzxusx commented 7 years ago

Hi, I have just installed this package and encounter this problem. I read the previous posts but found no answer.

When click rebuild index

Error parsing file ...
Scope stack not empty

I looked into the parse_fortran.py and found it in function dump_json . But I still don't know how to fix it.

When press Ctrl+Alt+g

Could not complete operation: Go To Definition
Indexing pending
Could not find definition: ...

debug output is as follows

program example !!! PROGRAM statement(1)
use test_module !!! USE statement(2)
real :: a !!! VARIABLE statement(4)
type(my_type) :: ex_var !!! VARIABLE statement(5)
end program example !!! END scope(10)
{"objs":{"example::a":{"desc":"REAL","fdef":4,"name":"a","type":6},"example::ex_var":{"desc":"TYPE(my_type)","fdef":5,"name":"ex_var","type":6},"example":{"desc":"PROGRAM","type":1,"mem":["a","ex_var"],"fbound":[1,10],"name":"example","use":[["test_module",[]]]}},"scopes":["example"]}

What's the problem?

Some information

Atom    : 1.14.3
Electron: 1.3.13
Chrome  : 52.0.2743.82
Node    : 6.5.0
Python : 2.7.12
OS : Ubuntu 16.04
hansec commented 7 years ago

@hzxusx Please create a new issue with this same information. This thread is not meant to be a catch all for all parser errors. When you create the new issue make sure you are running the debug test on the same file that generated the error in Atom. The error you are getting should be produced in debug mode too, so it is strange that your debug output contains no error.