-1

I tried to use environment variables in order to save data. I tried to save the variables with os.environ, but in linux the variables stay empty, after executing this small script:

  import os
    os.environ['LD_LIBRARY_PATH'] = "my_path"
    exit()

dave@dave-ThinkPad-L13-Gen-2:~/PythonProjects/USAImport$ echo $LD_LIBRARY_PATH

How to set environment variables in Python?

Which is the fastest way to persist data. I just have to save a cookie.

2

1 Answer 1

1

Environment variables is not way to save data, but a way, how to configure your application - it survive fork and exec operation.

To easily persist your data, I would recommend you using YAML or JSON file. Here is a nice answer, which helps you to do it on few lines.

data in the answer is dictionary. If you want a shortest possible way, how to persist data, you have to premake an empty JSON file with the right structure, so you can easily read on the first run without defining it in the code.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.