Ask coding questions

← Back to all posts
pipenv in shell
KrishanuDhar (3)

I have been having difficulties installing scrapy (https://replit.com/talk/ask/Not-able-to-install-scrapy/134335). Therefore, decided to do the usual way like I'd do in vscode.
Installed pipenv, did pipenv install of all the packages.

Upon executing it via pipenv: pipenv run pythin3 filename.py, I ran into a dotenv issue. I have a password stored in the environment variables, but I was not able to access it via my_token = os.environ['TOKEN']

After a bit of idle time when I got back to the shell, it no longer had pipenv and the packages installed. I mean, I will have to re-do the stuff now.

So, that's for some context to my follow on questions:
1. How do I get the environment variables stored in replit to work if I use pipenv?
2. How do I make pipenv and packages that were installed persist across shell disconnects?

Any suggestions?

Comments
hotnewtop
KrishanuDhar (3)

Any other suggestions on this thread? I am basically stuck without a clue of what to do next.

KrishanuDhar (3)

I do not know how to get this environment to work. Please let me know if you have used pipenv in repls.

98129182 (8)

I normally use the .envs with os.getenv(‘TOKEN’).

98129182 (8)

@98129182 Also, there should be a pyproject.toml file created. It didn’t though, causing this to happen. It should create automatically.

KrishanuDhar (3)

@98129182 thank you for the reply, but I wonder why it wouldn't work with replit's mechanism of storing the keys.

KrishanuDhar (3)

@98129182
Will a pyproject.toml get created for a pipenv environment as well?

KrishanuDhar (3)

@98129182
By the way, I don't think they allow you to create the .env file anymore.