I've been running a python script inside a virtual environment that I create with pipenv shell
, it worked well.
I've always run the process from a bash script that changes directory to the folder containing the python script, activates the virtualenv with pipenv shell
, then runs the python script, then exits the virtualenv.
However, I must have typed something wrong in the terminal and broke something, now I get this when I run the script inside the virtual environment:
Launching subshell in virtual environment...
Traceback (most recent call last):
File "/home/manuel/.local/bin/pipenv", line 8, in <module>
sys.exit(cli())
File "/home/manuel/.local/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/home/manuel/.local/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/home/manuel/.local/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/manuel/.local/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/manuel/.local/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/home/manuel/.local/lib/python3.8/site-packages/pipenv/vendor/click/decorators.py", line 73, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/home/manuel/.local/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/home/manuel/.local/lib/python3.8/site-packages/pipenv/cli/command.py", line 429, in shell
do_shell(
File "/home/manuel/.local/lib/python3.8/site-packages/pipenv/core.py", line 2387, in do_shell
shell.fork_compat(*fork_args)
File "/home/manuel/.local/lib/python3.8/site-packages/pipenv/shells.py", line 121, in fork_compat
c.interact(escape_character=None)
File "/home/manuel/.local/lib/python3.8/site-packages/pipenv/vendor/pexpect/pty_spawn.py", line 788, in interact
mode = tty.tcgetattr(self.STDIN_FILENO)
termios.error: (25, 'Inappropriate ioctl for device')
I have uninstalled and re-installed pipenv
but to no avail.
If I run the script without activating the virtual environment, I don't get the error above, but I have other issues.
What is causing this error? How can I get rid of it? Thanks.
pipenv run
and also that it helps to use absolute paths to the pipenv executable (to the output ofwhich pipenv
that I want to use). So now I use, say,/usr/local/bin/pipenv run python3.8 path/to/script.py
and it goes well. I hope this helps other people. – Refute