vscode python lint problem at the first column of first line - visual-studio-code

I have python modules that I run in VSCode for development.
And everything works fine until today VSCode suddenly said that one of the module had some binding problem and made the file name tab red.
VSCode the problem occurs in the first character of the first line which is the following standard line at every module of my program.
from __future__ import print_function # (at top of module)
But strangely VSCode did not raise the same problem for other module that starts with the same line.
The problem message is like this.
An internal error occurred while binding file "aModule.py": Error: Debug Failure. createKeyForReference received unexpected expression type
at createKeyForReference (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\codeFlowTypes.ts:240:9)
at createKeyForReference (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\codeFlowTypes.ts:218:25)
at C.visitAssignment (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:849:50)
at C.visitNode (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:132:29)
at C.walk (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:98:37)
at forEach (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:107:22)
at Array.forEach (<anonymous>)
at C.walkMultiple (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:105:15)
at C.walk (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:100:18)
at C._walkStatementsAndReportUnreachable (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:2583:22)
at C.visitSuite (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:345:14)
at C.visitNode (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:330:29)
at C.walk (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:98:37)
at callback (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:1290:22)
at C._trackCodeFlowExpressions (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:3236:9)
at C.visitIf (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:1265:48)
at C.visitNode (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:184:29)
at C.walk (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:98:37)
at C._walkStatementsAndReportUnreachable (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:2583:22)
at C.visitSuite (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:345:14)
at C.visitNode (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:330:29)
at C.walk (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:98:37)
at Object.callback (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:545:22)
at C._bindDeferred (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:4140:22)
at C.bindModule (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:298:14)
at callback (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\sourceFile.ts:1197:28)
at s.timeOperation (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\common\timing.ts:40:20)
at callback (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\sourceFile.ts:1184:38)
at t.LogTracker.log (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\common\logTracker.ts:43:20)
at t.SourceFile.bind (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\sourceFile.ts:1181:33)
at O._bindFile (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\program.ts:931:34)
at c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\program.ts:1051:18
Can someone help?
Thanks
Farn

Related

Workbox 6: ReferenceError: swDest is not defined

Getting ReferenceError: swDest is not defined when trying to run Workbox 6.
In my sw_build.js file I have that I call with node sw_build.js in my package.json file...
In the console I see this as the output:
It appears as though the files get created?, I just don't understand why I'm getting the odd error.
Your swDest reference is in line 16, and swDest is not defined. That's why the file is created but error occurs. I think you copied the example code without modification on this line.

Sikuli IDE Error - javax.script.ScriptException " is not defined in nashorn:mozilla_compat.js at line number 69

I'm working on a simple Sikuli Script.
The script is simply one line shown below
click()
The following error is produced?
javax.script.ScriptException: ReferenceError: "Commands" is not defined in nashorn:mozilla_compat.js at line number 69
I believe I have all dependencies installed. Could I ask for some assistance for what else is missing to move on from this error?
You are trying to use the commands in javascript mode. Do the following: create a new tab, right click on it, select "set type" and choose "jython". Your code should now work.

jupyter notebook with unicode characters PDF converting problems

I was making a math class note with some unicode characters (Simplified Chinese, in my case) in it. And when I was trying to convert it into PDF file, it popped out 500 error. The error message reads:
...
*************************************************
("E:\Program Files (x86)\MiKTeX 2.9\tex\latex\fontspec\fontspec.sty"
("E:\Program Files (x86)\MiKTeX 2.9\tex\latex\fontspec\fontspec-xetex.sty"
("E:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\fontenc.sty"
("E:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\tuenc.def"))
("E:\Program Files (x86)\MiKTeX 2.9\tex\latex\fontspec\fontspec.cfg")
! Undefined control sequence.
<argument> \LaTeX3 error:
Erroneous variable \c__fontspec_shape_n_n_tl used!
l.3806 \emfontdeclare{ \emshape, \eminnershape }
?
! Emergency stop.
<argument> \LaTeX3 error:
Erroneous variable \c__fontspec_shape_n_n_tl used!
l.3806 \emfontdeclare{ \emshape, \eminnershape }
No pages of output.
Transcript written on notebook.log.
I guess the fontspec part went wrong, but I don't know how to solve it.
For your information, here is what I've done before I got the 500 error.
1.I've installed the pandoc, and I already have Miktex before;
2.I've changed the file
...\nbconvert\templates\latex\article.tplx
rewritten the article class to be ctexart;
3.I've changed the file
...\nbconvert\templates\latex\exporters\pdf.py
rewritten the latex command to be
latex_command = List([u"xelatex", u"{filename}"], config=True,
help="Shell command used to compile latex."
)
4.I've also tried this:"https://github.com/ipython/ipython/issues/7150", which tends to convert the ipynb file into latex file first, then into PDF. And this didn't work for me either. The main reason is that the config file can't be found by jupyter nbconvert command.
For your information, my OS is Win7 Ultimate x64, with Chrome for Anaconda3 jupyter notebook.
Thanks in advance for anyone who takes time to read my post. Any help would be appreciated.

Protractor e2e test for downloading and comparing file with browser.driver.wait is timing out

I followed the suggestions in this thread: Protractor e2e test case for downloading pdf file and the file is downloading properly, but the test is timing out before the compare/expect is reached.
var filename = 'somefilename';
var content = 'some content\r\nsome more content';
download.click();
browser.driver.wait(function() {
return fs.existsSync(filename);
}, 5000).then(function() {
expect(fs.readFileSync(filename, {encoding: 'utf8'})).toEqual(content);
});
It creates and downloads the file and then sits there for 5 seconds before continuing on. The message I get is:
Message:
Error: Wait timed out after 5000ms
Stacktrace:
Error: Wait timed out after 5000ms
at Array.forEach (native)
From: Task: <anonymous wait>
at /path/to/test/e2e/scenarios.js:337:28
at Array.forEach (native)
Where line 337 is the browser.driver.wait line.
I tried doing it without the browser.driver.wait since the download is actually very quick since the file is just two short line by doing the following:
expect(fs.existsSync(filename));
browser.sleep(5000);
expect(fs.readFileSync(filename, {encoding: 'utf8'})).toEqual(content);
but it says that the filename doesn't exist for readFileSync and I assume this is because the file is not downloaded yet and the browser.sleep(5000) doesn't do anything.
Is there another way to do promises in protractor? Or can anyone clue me in as to why this might not be working? I'm running Protractor 2.1.0. I was running 1.0.0 and updated everything before trying again, but alas, it still isn't working.
Best regards,
Julie
I figured out the problem. My filename didn't contain the path that I set in the 'default_directory' of my protractor-conf.js file. Once I put in the whole path, it worked. Boy do I feel silly!

How to import github repos into Atom editor?

In Atom editor, there is an import package that should allow user to import github repos into the Atom, here: https://atom.io/packages/import
I've tried it and it didn't work and gave me this error:
Uncaught TypeError: Cannot read property 'projectHome' of undefined
An issue was also raised but did anyone else have the same problem and know how to resolve this? My system is an Ubuntu 14.04.1
How to import Github repos into Atom editor?
I've tried to remove ~/.atom/config file but it doesn't exist:
alvas#ubi:~/.atom$ ls
compile-cache config.cson nohup.out packages storage
I've tried removing the config.cson and the same error. When i tried to grep for ProjectHome, i got:
alvas#ubi:~/.atom$ grep -nRHI projectHome *
compile-cache/coffee/5047aaae22a3f9ac99b5d85d388d780b7e76a729.js:96: workspace = atom.config.settings.core.projectHome;
compile-cache/coffee/5047aaae22a3f9ac99b5d85d388d780b7e76a729.js:97: defaultWorkspace = atom.config.defaultSettings.core.projectHome;
packages/import/lib/import-view.coffee:41: workspace = atom.config.settings.core.projectHome
packages/import/lib/import-view.coffee:42: defaultWorkspace = atom.config.defaultSettings.core.projectHome
You can try, to see if that make the issue go away, a similar solution like issue 3845:
Hm, the issue disappeared after I'd remove my ~/.atom/config.
I don't remember if I set something there with hands – guess some of local installed package did something :(
You can see a similar error at Atom.project.path (cannot call path of undefined in test), which points out that not every variable are set.