Unable to add environment variables - windows-10

I have an extremely annoying issue where I am unable to set a new environment variable.
As per this question, I am simply trying to set up authorisation for an application to use a google API.
I tried setting the variable with
set GOOGLE_APPLICATION_CREDENTIALS="C:\Users\Bassie\Documents\.credentials\google-translation-api\My Project-d885ebbbe907.json"
But this does nothing.
Then I manually went into system variables and added it, see:
Yet still, if I call these commands:
echo %GOOGLE_APPLICATION_CREDENTIALS%
it just echoes
%GOOGLE_APPLICATION_CREDENTIALS%
and calling set does not display the variable as being there.
Has anyone else seen this issue? Please help me.
By the way I am using windows 10

Related

Activate venv in vs code

I have been trying to activate a virtual environment using Python built-in module venv from VSCode, But it didn't work properly And I didn't receive any error message. However, and also If I use venv\Scripts\activate.bat command in terminal it doesn't work.
Are you correctly setting up the venv?
python3 -m venv env
Then in the below section of your vscode taskbar you will find
Then select your interpreter(env) to use:
There are three things that I would check:
Does your vs-code have a default virtual environment defined as a user setting? Is that the one your current workspace is using?
Have you moved the folder you are working in since creating a virtual environment? If so, you should edit your venv/bin/activate script so that it has the correct value for the VIRTUAL_ENV variable.
In your project, do you have a .vscode/settings.json file that is referring to the wrong location or a location which doesn't exist? Specifically thinking of the "python.defaultInterpreterPath" setting.
These are things that I came across today when I had a similar problem. Hopefully that helps someone else!
{Ctrl+shift+'}
this will open a new terminal and automatically activate your virtual environment, found this in vs code documentation for flask virtual environments.
I also tried venv\Scripts\activate.bat and it wasn't having it; however cant remember the issue I was having.
Hope this saves some one a lot of time.

ghci only loads with admin

I've been trying to install Haskell platform with chocolatey but have been unable to get it working without running the command prompt as an administrator.
When I do so normally it just states that "ghci is not recognized as an internal or external command", but when I do so with admin privileges' it works fine.
I looked at this thread and attempted to add the pthread.dll file to my system but this seemed to just make the program run worse as admin. I'm confused why something that should be so basic as setting up a programming language is giving me so much headache
Ok, managed to fix it by making an environment variable directly to my C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.10.3\bin location.
I thought making an environment variable to C:\ProgramData\chocolatey\ would have been sufficient but clearly not. Weird too as Chocolatey added many of its own environment variables but not one that pointed to gchi

how to use environment variables in vscode settings json

I want to be able to use linux environment variables in vscode workspace settings (specifically $HOME) so that I can specify paths that aren't specific to a user. In this case I am trying to set the java.home setting.
I have tried using ${env:HOME} but this doesn't seem to work. I suspect this is only for vscode tasks.
{
"java.home": "${env:HOME}/.sdkman/candidates/java/8.0.222.hs-adpt/"
}
Get the following error message at the moment:
The java.home variable defined in VS Code settings points to a missing or inaccessible folder (${env:HOME}/.sdkman/candidates/java/8.0.222.hs-adpt/)
Environment variables in Linux are supported now in VSCode (although I don't know since when or which version exactly). I have VSCode for Linux 1.73.1.
You can now use the following (just like in the question above):
{
"java.home": "${env:HOME}/.sdkman/candidates/java/8.0.222.hs-adpt/"
}

Python script works for one user, but not another on same machine

Another team created python scripts within our organization for my team to run. Up until two weeks ago, we all ran them without any problems. Then one day, some users have been unable to run them successfully on the same machine.
All users are admins with LUA disabled. All users should have the same permissions.
The complicating factor here is the team created a "framework" which generates code from a combination of the framework, and an excel file for the tests being run. This prevents me from stepping through the code and finding where it's specifically failing. Beyond that, the same exact script runs on the same machine when another user trying to run it.
Specifically, in the script, it appears that when the affected users are running the script, IEDriverserver doesn't appear to open. No errors are given.
Is there any environmental variables that could be specific to users that would cause this? Even a direction to look would be extremely helpful.
Does it always fail in the same part of the Python code? Does opening the Excel file have anything to do with it, perhaps? I mean, if someone has the Excel file open on a network drive, and someone else is trying to write to the file, i'm pretty sure this will trigger an error, unless the Excel file is 'shared'. Just a couple thoughts.
I encountered the similar issue today. I happen to solve it by unset PYTHONHOME and PYTHONPATH. Not sure if this helps.

nodejs openshift cartridge - not reading custom environment variables

I am identifying my openshift nodejs app environment through system environment variables Ex: 'staging', 'production'. My custom environment variable name is OPENSHIFT_APP_ENV. I have set this in .bash_profile and ran source .bash_profile.
When I did printenv or echo $OPENSHIFT_APP_ENV in command line in my openshift app, I can see the values set properly.
But these variables are not read/set in my nodejs app. I am simply trying to read it as global.ENV = process.env.OPENSHIFT_APP_ENV || "development";
I feel that it should be simple setting issue, but could not get this working somehow. Any help will be appreciated.
You should use the rhc env set command as explained in this section (https://developers.openshift.com/en/managing-environment-variables.html#custom-variables) of the Developer Center to set your environment variables. Especially if you are using a scaled application, that makes sure that your custom environment variables are created on all gears.
It is also standard practice (i believe) to use the NODE_ENV environment variable to determine what environment you are operating in.
You should also make sure to stop & start (not restart) your application after you create environment variables to make sure that your process picks them up correctly (may solve your issue of your application not seeing the ones from your .bash_profile, but i would still recommend using the rhc env set command instead)

Resources