question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No evidence of run when using pipenv run.

See original GitHub issue

Issue description

When running a python script using pipenv run nothing happens - no print output is generated. However, when running same script inside pipenv shell everything seems to be fine.

Expected result

Both pipenv run main.py and pipenv shell and then python main.py should show the same output/

Actual result

When possible, provide the verbose output (--verbose), especially for locking and dependencies resolving issues. image

image

Steps to replicate

Provide the steps to replicate (which usually at least includes the commands and the Pipfile).

main.py:

import os, sys

print("PYTHON =", sys.executable)
print("VERSION =", sys.version)
print("HTTP_PROXY =", os.environ.get("HTTP_PROXY"))
print("HTTPS_PROXY =", os.environ.get("HTTPS_PROXY"))
print("REQUESTS_CA_BUNDLE =", os.environ.get("REQUESTS_CA_BUNDLE"))
print("CURL_CA_BUNDLE =", os.environ.get("CURL_CA_BUNDLE "))

Pipfile

url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
requests = "*"
certifi = "*"

[dev-packages]

[requires]
python_version = "3.9"

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
kobayashicommented, Oct 6, 2021

pipenv run main.py is not working because pipenv run executes the following commands in your virtual environment. So, you have to do pipenv run python main.py for the example. Or you can set custom script shortcuts in Pipfile to run directly with pipenv run <your-custom-script> . Check here for the detail.

0reactions
ms-86commented, Dec 8, 2021

Hi

It turned out it’s not working on one of my computers because something was wrong with file associations in Windows. So every python script had to be prefixed with python. After I fixed this then I could use pipenv run script.py with the results just as expected.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using 'pipenv run' can I run a script outside of the project folder?
When in that folder and not in the pipenv virtual enviroment. I can use the command pipenv run script.py and it works.
Read more >
A tool all Python developers should be using - Medium
This post is about my first experience from a blank canvas to production ready code using pipenv as the package manager plus testing...
Read more >
Frequently Encountered Pipenv Problems - Read the Docs
Here are some common questions people have using Pipenv. Please take a look below and see if they resolve your problem. Note. Make...
Read more >
Common Pipenv Errors - Towards Data Science
Notice after running ls there is no Pipfile or Pipfile.lock generated. That is because Pipenv has found the Pipfile higher up in the...
Read more >
Pipenv run vs Pipenv shell - Anselmos Blog
Pipenv has a run and shell, but which one should I use ? ... for the next RUN command or any other command...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found