add `DEBUG=1` commands to windows?

0

Issue

I’m trying to use kaki
library with kivy and python but to use it you need to run

DEBUG=1 python main.py

but I’m facing this error

DEBUG=1 : The term 'DEBUG=1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that 
the path is correct and try again.
At line:1 char:1
+ DEBUG=1 python main.py
+ ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (DEBUG=1:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException


but I can find any source about how to add this command to my path

I’m using

python:3.7
windows 10

I will add any information if need it

Solution

In PowerShell, you can write to an environment variable which will be inherited by child processes, like this:

PS ~> $env:DEBUG = 1
PS ~> python main.py

Or as two statements on a single line:

$env:DEBUG = 1; python main.py

Python will now get the value 1 when resolving the DEBUG environment variable

In cmd.exe you can use the set keyword:

C:\> set "DEBUG=1" && python main.py

Answered By – Mathias R. Jessen

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More