Python Forum

Full Version: Setting permanent user variables in Windows
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Greetings!

I've read through a lot of posts and didn't manage to make it work.
My problem is that I'm unable to insert my variable in this statement:
roomNr= inputbox.get()

exp = 'setx roomNumber' roomNr
subprocess.Popen(exp, shell=True).wait()
Hi @coder420 ,
Welcome to the forum. Do you get an error message when you execute this? Something like:
Error:
File "<input>", line 1 exp = 'setx roomNumber' roomNr ^ SyntaxError: invalid syntax
Always post error messages. What could be wrong with this line?
did you mean: exp = 'setx roomNumber' + roomNr
better expressed as: exp = f"setx roomNumber {roomNr}"