AutoPEP8, Anaconda, Sublime Text 3 Inconsistent Error Reporting - python-3.x

Please reference the attached screenshot.
I am working on a scrapy pipeline. I am using Sublime Text 3 with Anaconda/AutoPep8. I just moved over from ST2 where I did not have AutoPep8 or Anaconda.
The huge white dot is telling me that this line has invalid syntax. I could not figure out what the problem was, so I copied the line and pasted it here on line 1 of what was then an empty file. The syntax error still showed, suggesting it was not a problem with a prior line missing a closing parenthesis.
Then I made up some similar code, lines 3, 6, & 9. As you can see, they all pass muster. (I don't care about the other little errors, they are not the issue).
Then I pasted in the entire method over onto this new document, and now, as you can see, even the suspect line (22) passes.
Then I copied and pasted the whole class, and again, as you can see, line 49, the code it was complaining about before now doesn't cause any issues at all.
I tried using the command palette - PEP8: Preview Changes, (see https://github.com/wistful/SublimeAutoPEP8) but nothing happened.
I also tried the right click menu Anaconda > Autoformat PEP8 Errors but the E501 errors (line too long) were ignored and nothing happened with the supposed syntax error in the if statement.
Note: When I first started using AutoPep8 to fix E501 errors last week, I noticed that about halfway through a script, it suddenly stopped reporting errors at all. Don't know if this is related.
I also get this error when ST3 starts: https://github.com/DamnWidget/anaconda/issues/514. However, the consensus seems to be that if Sublime works even after you click through this error, it is nothing to worry about. I just mention this to give you as much as I know so you can help.
I also tried turning len('advocate') into a string, but the syntax error remains.
What is going on here? Is there a bug in Anaconda, AutoPep8, ST3, or my code?
Ubuntu 16.04, Python 3.4, (but 'automatic' build in ST3) ST3 Build 3126 (I don't know how the Build number lines up with a version number) Anaconda, AutoPep8 version numbers unknown, but I got them less than two weeks ago.

Well, it took a lot of very patient Googling and a comparison test in VSCode, but I have the astoundingly simple answer: I should have put '==', not '=' ! Yes, dear friends, it is basic Python. = means assignment, == mean equality or comparison. My if is of the latter type, because you can't make an assignment in an if statement. Now VSCode didn't make this any clearer, I think they both use Pylint, but it at least let me know that this was probably a valid error, whether I understood it or not. (Unless of course I know more that the devs at Pylint...Yea, not likely).
Kudos to Jean Mark Gawron, (who must be related to the Klingon Emperor) for giving me the answer: http://gawron.sdsu.edu/python_for_ss/course_core/book_draft/programming_intro/boolean_results.html

Related

Pylint Wrong or no encoding specified

I'm maintinaing a library of python code. All bar one of the modules in the library runs through pylint with no problems.
For this one module pylint returns error F0010.
<some_module>.py:1: [F0010(parse-error), ] error while code parsing: Wrong or no encoding specified for <some_module>.py
I've stared at the code for hours and I can't see quite what's so special about it. There is nothing that jumps out at me as being different in any substantial way to the other modules in the library. File names, headers, footers are all very similar, PEP8 etc etc.
Does anyone have any hints for debugging this error?
If nothing else I'd like to have a pylint score for it so I can justify its existence in its current form, and I really don't want to rewrite it from scratch to appease pylint.
Turns out I've managed to fix the problem.
Whoever edited it last saved it as ANSI rather than UTF-8.
Thanks for the pointers, as its not somethign I would have thought of checking. I found this out when I was looking to see what it was actually encoded as, in response to the comments above. I'd have assumed it was UTF-8 as all the other files in the library are UTF-8, in fact everything here is utf-8, apart from this one file...
Now to up its pylint score a bit.

LaTeX document errors where no errors exist

I am writing my thesis with LaTeX and since today very curious errors turn up. I wrote something and made a citication in the file references.bib, and then the errors turned up. Befor writing that few lines everything worked great. Thus, I deleted everything I've added. But the errors still turn up. One Error is: Extra }, or forgotten $. ...ckoverflow Permission SYSTEM_ALERT_WINDOW}. I think my citication (which I've deleted after the errors turned up) is still stored somewhere , because "ckoverflow Permission SYSTEM_ALERT_WINDOW" was a part of the title of the cite.
I hadn't found any error in any file.
The next weird thing is that a mate of mine can compile that files without any problems. He is using WinEdt. I am using TeXStudio, but I've tried it with WinEdt, too.
There is a screenshot of my errors:
Please help me, any suggestions are appreciated.
Best regards
Looks like you might need to escape your _ characters there, as they are normally used for subscript, but only in math mode; hence the "missing $ inserted".
(La)TeX error messages make me sad... :(

Error on using Vim-latex ("can't find file ~")

I'm not sure if this question is appropriate here but I have nowhere else to ask. I recently started to typeset some 'mathsy' stuff using Latex and it became a hobby for me. I've been using TeXnicCenter for this, but feeling that I've got familiar with Latex language, I decieded to improve 'efficiency' of typesetting by changing the editor.
So I decided to use Vim (latest version, 7.4) with Suite-Latex. I've just installed Vim and Suite-Latex, following exactly what was instructed here. I made every necessary changes mentioned here, and it seemed to me that installation was successful (I got what was expected on Step 4)
Then I started to work through this tutorial and everything went fine until this section.
When I press F9 for autoreference, I see that Vim is working on something for split seconds and red error message refering to "can't find [some file name]" in my user/appdata/local/temp directory. The "file name" changes every time I do this (so its kind of temporary file as its directory suggests?). And then it produces a new window with title __ OUTLINE __ where 2 empty lines are showing up.
If I press n (in the new window described above) error message saying "E486: Pattern not found: rf" pops up and pressing j results in going down one row. If I press enter key, message ":call Tex_FinishOutlineCompletion()" pops up.
More frustratingly, if I try to compile a file by entering command \ll, a new window pops up where there are two lines saying:
1.ll I can't find file `newfile.tex'. newfile.tex
2.ll Emergency stop
and below these is a message saying
[Quickfix list]: latex -interaction=nonstopmode -file-line-error-style newfile.tex
So I thought it maybe is something to do with VIM not being able to find files in my computer (so something wrong with grep?), and I tried to resolve it by downloading a software called "cygwin" on which developers said their tests were successful, but it changed nothing.
But I think the two problems are related.
As it is, I am completely newbie in this type of editing environment (or any kind of programming) but I really would like to learn some Vim seeing how efficient it is in typesetting etc. Sorry for not being a pro at typing codes here. Thanks for reading!
I believe you need a latex compiler---I've had this issue and well, one thing that's left out of the conversation a lot is the compiler (pdflatex, latexmk, etc). As of now, you should download a compiler since vim-latex (latex-suite) doesn't actually come with a compiler (that I know of) and it's just a plug in with some cool stuff in it, but not what you need to make a file.pdf out of your file.tex.
It happened to me before. I found out that this problem may happen when you have special characters (such as white space and other symbols) in your file name or folder path. Try again with file name and path only in English letters.

ghc-mod only shows first line in *GHC info*

I am using emacs (24.3.1) in haskell-mode together with ghc-mod to play with Haskell.
Now everything works fine aside from one annoying thing:
Every output in the GHC info buffer contains only the first line.
For example when I ask for ghc-show-info (let's say on sqlSettings from persist) I get this:
while Interactive-Haskell works fine:
This happens with everything: infos, errors, warnings, etc.
Right now I have no clue what is causing this issue as it seems that ghc-mod in emacs is parsing the output wrong.
Maybe someone can help me get all the info.
Thanks
PS: maybe this one shows the problem a bit better:
instead of
It might be this bug https://github.com/kazu-yamamoto/ghc-mod/issues/297
It has been fixed recently with ghc-mod >= 4.1.6

GHCI character limit?

I'm using ghci to do some incremental development using Emacs' run-haskell. Every once in a while, I get an error that looks like
<interactive>:[line]:[character]: _Lexical error at character '\EOT'
Setting up an intermediate variable or two gets a working response, and the file I'm working on both loads and compiles properly. Reducing character count also works; the max I seem to be able to hit is 252.
Anyone have an idea of what's going on?
This was filed and closed as a bug in GHC several years ago, so looks like no dice on fixing it at the GHCi end. (Searching "_Lexical error at character '\EOT'" gives a few other results (for example), but I can't work out how applicable they are.)

Resources