All Questions
30 questions
0
votes
3
answers
90
views
zsh: no matches found: MultiplicateLists(np.array([1,3,5,6,4,6,7,1,2,7]))
I would like to import a list in a python function and run the function from the terminal of Visual Studio Code. My function, that I called "MyFunction.py", and that I temporarily saved on ...
-1
votes
1
answer
44
views
Calling `subprocess` in Python notebook has different `$PATH` than `!` shell
I am developing a wrapper class interactively in an IPython notebook. This wrapper class invokes a command line program written in java, and thus I need access to the same version of the java runtime ...
0
votes
0
answers
141
views
In macOS, how do I detect low data mode in command line or Python?
I want to write a script that executes only if the low data mode is turned off on the network adapter. But I can't find a solution on Google. Is it possible to write such the check in a script?
I have ...
0
votes
0
answers
52
views
Cannot activate Python virtual environment from within shell script (zsh) [duplicate]
I cannot activate a Python virtual environment from within a shell script (zsh).
I have tried the following:
#!/bin/zsh
conda create -n myenv python=3.10
conda activate myenv
It sends me the error ...
0
votes
2
answers
414
views
How to send keys to a python pdb shell from bash script?
I am trying to create a bash script that runs a python3 script with pdb trace set. As such, in my bash script I have the following lines:
python3 path/to/my_script.py
n
What I want to happen is for ...
2
votes
0
answers
41
views
Another Python not working in cron question [duplicate]
Directory: path/to/test
tree:
.
├── Pipfile
├── test.py
├── test.sh
└── test.txt
test.py:
#!/usr/bin/env python3
import datetime
with open("/path/to/test/test.txt", "a") as f:
...
0
votes
2
answers
535
views
pyenv shell errors after uninstalling pyenv
I've recently been diagnosing why my pyenv installation is giving me errors in the shell. After trying everything I could find, I thought I would remove it from my system. However, after uninstalling, ...
0
votes
2
answers
1k
views
Python os.environ doesn't show empty environment variables
After an environment variable is exported and set to empty, I can't get its value in Python with os.environ. Is it expected?
Examples:
## export TEST_ENV_VAR
(base) ➜ Code export | grep TEST_ENV_VAR
...
1
vote
2
answers
3k
views
How to manage Python path on MAC
I try to run Django project and create a new app. When the terminal run python manage.py makemigrations ,Django cannot be found and import error ,and the virtual environment is not activated?
After I ...
3
votes
2
answers
9k
views
add Pyenv commands to bashrc or zshrc?
This tutorial to create virtual environments suggests, that I should add these commands to my .bashrc file:
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
On the home ...
-1
votes
1
answer
211
views
interact or cancel a command that is waiting for input in bash and zsh on macos
I need a way to cancel a command that is waiting on input or send input to it so it moves past the waiting for input stage here's the scenario
I have a script and in it I am running a python script ...
0
votes
2
answers
8k
views
Launching Python script from zsh and staying in Python shell [duplicate]
I would like to simplify running Python scripts from within the Python shell. In Python 2, you could just use execfile(path). But in Python 3 it's harder to remember:
exec(open(path).read())
So I want ...
0
votes
2
answers
2k
views
Add to ~/.zshrc file with python
I'm trying to write a cli that will take a users path that they input into the command line, then add this path to the correct path file depending on their shell - in this case zsh. I have tried using:...
0
votes
1
answer
2k
views
When switching to zsh shell on mac terminal from bash, how do you update the base python version?
Mac has recently updated its terminal shell to Zsh from bash. As a python programmer, I'd like to have a consistency in python versions across all the systems that includes terminals, & IDE.
On a ...
0
votes
1
answer
346
views
What does `hash -r 2` do?
I found this code in virtualenv activate file:
# This should detect bash and zsh, which have a hash command that must
# be called to get it to forget past commands. Without forgetting
# past ...