"unresolved import"-error: including path for code completion and pylint in VSCode - visual-studio-code

In order to have code-completion and functioning linting, I'd like VSCode to include a specific path.
https://code.visualstudio.com/docs/python/environments#_environment-variable-definitions-file
I created a test environment
$ pwd
==> /Users/stephan/saitc/test_ws
$ ls -a
==> . .env tst_pckg
==> .. __init__.py
==> .DS_Store testing.code-workspace
$ cat .env
==> PYTHONPATH="/Users/stephan/saitc"
$ ls tst_pckg/
==> CONST.py __init__.py testing.py
$ cat tst_pckg/CONST.py
==> # -*- coding: utf-8 -*-
==>
==> TEST_CONSTANT = "Test constant's value"
$ cat tst_pckg/testing.py
==> # -*- coding: utf-8 -*-
==>
==> from test_ws.tst_pckg.CONST import TEST_CONSTANT
The setting "python.envFile" is set to "${workspaceFolder}/.env"
With this setup I would expect that VSCode is aware of the package "test_ws" but typing the line:
from test_ws.tst_pckg.CONST import TEST_CONSTANT
in the file "testing.py" gives my no reasonable code completion and "test_ws.tst_pckg.CONST" can not be resolved ("unresolved import"-error in the VSCode ui).
I'm using Anaconda on macos and the Visual Studio Code 1.30.1 which comes with it. Can it be that I have to start visual studio code from the directory "/Users/stephan/saitc/test_ws"? (if so how?)
With every start of Visual Studio Code I'm asked if I want to start the pylint extension. How can I turn this on permanently? (Python›Linting: Pylint Enabled, Python›Linting: Enabled)
Thank you,
Stephan

You can use the configuration "python.autoComplete.extraPaths": ["./your-source/folder"].
As far as I understand is the env file only used when you start a terminal and so on but not for the extensions.

Related

Deno: Denon installation with fish in mac

Using fish for the installation of denon don't recognize it
steps:
Open fish terminal
deno install -qAf --unstable https://deno.land/x/denon/denon.ts
export PATH="/Users/user/.deno/bin:$PATH"
denon --init
output:
fish: Unknown command: denon
Deno version:
deno 1.28.3 (release, x86_64-apple-darwin)
v8 10.9.194.5
typescript 4.8.3
Denon 2.5.0
Solution:
export PATH="/Users/user/.deno/bin:$PATH"  ✔  ⬢ 16.17.0 
source ~/.profile
you could get the next error:
~/.cargo/env (line 4): 'case' builtin not inside of switch block
case ":${PATH}:" in
^
from sourcing file ~/.cargo/env
called on line 1 of file ~/.profile
from sourcing file ~/.profile
.: Error while reading file '/Users/user/.cargo/env'
go to .config/fish/
and nano config.fish
and paste the next exports so, it looks like this:
if status is-interactive
# Commands to run in interactive sessions can go here
export PATH="$HOME/.cargo/bin:$PATH"
export PATH="/Users/user/.deno/bin:$PATH"
end

FAILED: list-all did not return any version

I'm trying to install Java with the asdf plugin.
I could get the plugin but I cannot get the Java list.
The command:
asdf plugin-test java https://github.com/halcyon/asdf-java.git
gives me the message:
FAILED: list-all did not return any version
I'm on Windows 11 in a Tabby 1.0.179 / Git bash terminal.
Previously I could run the commands:
asdf plugin list
asdf plugin list all
asdf plugin add java
cd ~/dev/projects/myproject
asdf list
asdf list java
But the command:
asdf list all java
fails with the message:
Plugin java's list-all callback script failed with output:
/c/Users/stephane.2143929/.asdf/plugins/java/bin/list-all: line 1: functions: command not found
Indeed the ~/.asdf/plugins/java/bin/list-all file contains only one word: functions
As the access to the git repository is done through https and not ssh I have previously specified the GITHUB_API_TOKEN environment variable which is correctly set as seen by an echo $GITHUB_API_TOKEN command.
Regarding the git configuration, I was having the error message:
SSL certificate problem: unable to get local issuer certificate
and the property http.sslbackend had the value openssl
as showed by the command:
git config -l --show-origin
Then I typed in the command:
git config --global http.sslbackend schannel
and verified the changed property again:
git config -l --show-origin
and I could then clone some repository.

environment variable not accessible when start python script by pydev runner

My configuration:
ubuntu 16.04 eclipse 4.7 python 2.7.12 PyDev 6.2.0.2017
When running test.py which contains blow code from PyDev:
print os.environ['PATH']
Expected values got printed out,then change 'PATH' to 'LIB_ROOT'
print os.environ['LIB_ROOT']
Got error:
LIB_ROOT=os.environ['LIB_ROOT']
File "/usr/lib/python2.7/UserDict.py", line 40, in __getitem__
raise KeyError(key)
KeyError: 'LIB_ROOT'
And same variable can be accessed from ipython console
and run test.py in bash
python test.py
expected valued got printed out also,can anybody tell me why?

OmniORB compilation error Windows 7 64 bit

Has anyone encountered the error below when compiling omniORB_4.1.6 64-bit for windows?
'RegQueryValueEx failed - error 109'
I followed the procedure in the readme.win32 and I get linking errors in the omniDyamic, codesets etc.. So someone suggested to rebuild the omniorb_root/src/tools/win32 and copy it in bin/x86_win32/. That's what I did and when I recompile the whole omniORB, the error is as below:
../../../../bin/x86_win32/omkdepend -D__cplusplus -D_MSC_VER -DIDLMODULE_VERSION
="0x2630" -DMSDOS -DOMNIIDL_EXECUTABLE -Ic:/python27/include -Ic:/python27/PC -I
c:/python27/include/python2.7 -DPYTHON_INCLUDE=<Python.h> -I. -I. -I../../../../
include -D__WIN32__ -D_WIN32_WINNT=0x0501 -D__x86__ -D__NT__ -D__OSVERSION__=4 -
D_CRT_SECURE_NO_DEPRECATE=1 idlc.cc idlpython.cc idlfixed.cc idlconfig.cc idldum
p.cc idlvalidate.cc idlast.cc idlexpr.cc idlscope.cc idlrepoId.cc idltype.cc idl
util.cc idlerr.cc lex.yy.cc y.tab.cc
RegQueryValueEx failed - error 109
-----------------------------------------------------------------------------------------------
make[4]: Entering directory `/cygdrive/c/Software/COTS/omniORB/omniORB_4.1.6/src
/tool/omniidl/cxx/cccp'
../../../../../bin/x86_win32/clwrapper -gnuwin32 -c -O2 -MD -GS -GR -Zi -nologo
-DHAVE_CONFIG_H -I. -I. -I. -I../../../../../include -D__WIN32__ -D_WIN32_WINNT=
0x0501 -D__x86__ -D__NT__ -D__OSVERSION__=4 -D_CRT_SECURE_NO_DEPRECATE=1 -Focexp
.o cexp.c
RegQueryValueEx failed - error 109
I'm going to answer my own question because it seems nobody has encountered this problem, and the mailing list is so quiet.
Someone suggested to me to recompile the src\tools\win32. So that's what I did and I copied the .exe files generated to bin\x86_win32.
I then compiled all the omniORB and get the RegQueryValueEx error.
The reason for this is when you check the src\tools\win32\bccwrapper.c in the void GetMounts(void) function,
it looks for this path in the registry:
Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\%02X.
When I checked that using regedit, I noticed that in the mounts->00, 01, 02, 03 etc.. keys, there are no 'unix' and 'native' string values inside those keys.
So I decided to delete all the keys and retained just the 00 and added a 'unix' and 'native' string value.
After which, I recompiled the src\tools\win32 and copied over the created .exe files to bin\x86_win32 and finally when I recompiled all the omniOrb, it started compiling (need to copy the ssl libs too) and finished successfully.
I really don't even know how the following got into my registry:
Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\%02X.
Best regards,
Mark
I spent quite some time trying to compile OmniORB on windows 10 with visual studio 2017.
Assuming Cygwin64 was installed in directory
c:\software\cygwin64
, the compilation of OmniORB is quite straightforward:
open a command terminal (cmd)
in that terminal, setup the Visual environment:
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
then, append the PATH (yes append and not prepend):
set PATH=%PATH%;c:\software\cygwin64\bin
then, in file config\config.mk, uncomment this line
platform = x86_win32_vs_15
in file platforms\x86_win32_vs_15, set PYTHON to target the python executable, in my case Python 3.6.5
PYTHON = /cygdrive/c/software/Python/python
finally start the compilation with make:
make export
Hope this helps.

How to set node path for nodejs (Ubuntu)

I'm trying to setup nodejs to access a postgres database. What I've done so far is the following (https://gist.github.com/579814):
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl http://npmjs.org/install.sh | sh
then
git clone git://github.com/isaacs/npm.git
make
make install
so far, so good. However, when I try to install the postgres driver
npm install pg
I get the following:
node-waf configure build || true
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : not found
Checking for node prefix : ok /usr/local
Checking for program pg_config : /usr/bin/pg_config
'configure' finished successfully (0.066s)
Waf: Entering directory `/home/christian/node_modules/pg/build'
[1/2] cxx: src/binding.cc -> build/default/src/binding_1.o
../src/binding.cc:3:25: fatal error: node_events.h: No such file or directory
compilation terminated.
Waf: Leaving directory `/home/christian/node_modules/pg/build'
Build failed: -> task failed (err #1):
{task: cxx binding.cc -> binding_1.o}
I've been looking around for setting the node path, although haven't found anything of help so far - probably also because I'm totally new to nodejs, so I'd be happy about any hint.
Now, you have NodeJS installed in your Ubuntu. You should set /etc/environment and load nodeJS path that can be executed by another users. For example:
NODE="/home/ubuntu/local/node"
NODE_PATH="/usr/local/lib/node_modules"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:$NODE/bin:$NODE/lib/node_modules"
#PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
Do this in bash:
echo 'export NODE_PATH=~/local/:~/local/node_modules' >> ~/.bashrc
before things are fixed you must use node 0.5.1 (you can use gitk to revert the tree to this version)
Auteur: Ryan Dahl <ry#tinyclouds.org> 2011-07-19 10:46:38
Auteur du commit: Ryan Dahl <ry#tinyclouds.org> 2011-07-19 10:46:38
Parent: 0a3fc1d9c8becc32c63ae736ca2b3719a3d03c5b (Remove StatWatcher's dep on C++ EventEmitter)
Enfant: 061ce7b0ac370c8a5ae93d95ab7da171cbd488f0 (net_uv: Fix simple/test-http-expect-continue.js)
Branche: master, remotes/origin/master
Suit: v0.5.1
Précède: v0.5.2
Finally remove node::EventEmitter
I had the same problem.
The issue was that I was specifying a old version of PG in my package.js
After I removed the old version dependancy I was able to install PG without issue.