1,103 questions
-1
votes
1
answer
41
views
Why does /usr/bin/python3 report /Library/Developer/CommandLineTools/usr/bin/python3 as sys.executable?
I encountered a situation on macOS where the path reported by sys.executable is different from the Python interpreter I explicitly ran. Here's what I observed:
I started Python using `/usr/bin/...
1
vote
2
answers
47
views
R, how to get current time miliseconds, without extra information ? (Sys.time(), format("%X"))
I have tried to get just the current miliseconds from the current second in R with the following code:
options("digits.secs" = 6) # since 6 is the maximum digits for seconds apparently
Sys....
-1
votes
1
answer
51
views
When debugging in VS Code, it doesn't take command inputs for Python
While debugging in VS Code, I am trying to give command lines but it doesn't take any and it moves directly to input(). Here len(sys.argv) is always equal to one.
I saw an old question which was ...
0
votes
1
answer
18
views
Inside pdb just before executing a Python script, can you set up your own sys.audit() hook?
Just before running a Python script inside pdb (using python -m pdb), I tried to add a handler for sys.audit() calls:
interact ← puts pdb into interactive Python mode
import sys
def myaudit(event, ...
2
votes
2
answers
172
views
How to make the window size to constantly shrink in pygame?
I'm making a game in pygame and for one of the levels in my game, the window would shrink constantly, forcing the player to move fast before they couldn't see the screen anymore but I don't know how ...
0
votes
0
answers
29
views
Experiencing an error when trying to import from a diffrent directory
i am trying to import a function from another file
a/b/c.py
a/1/2.py
i wanted to import a funciton from c.py in 2.py
sys.path.insert(1, '/path/to/c/py/a/b/c')
from c import function1, function2
i ...
2
votes
1
answer
98
views
Why my code prints multiple same lines when it reaches the end of terminal?
import time
import sys
def animate_string(input_string, delay_second=0.01):
current_string = ""
for target_char in input_string:
if target_char == '\n':
# Print ...
0
votes
1
answer
125
views
OSError: [WinError 10093] Either the application has not called WSAStartup, or WSAStartup failed
import sys
import select
print("Who is your best friend?")
print("You have ten seconds to answer!")
a, b, c = select.select([sys.stdin], [], [], 10)
if (a):
print("You stated ...
0
votes
1
answer
47
views
Import modules from a subfolder
I cannot import modules from a subfolder,where from a subfolder that I am in it;
the folders that I work with, is like this:
Project
__init__.py
/objects
__init__.py
button.py
...
0
votes
1
answer
55
views
Terminating a python program from within a try block [duplicate]
I have a python program that takes integer only inputs like this:
Valid = False
while not Valid:
try:
x = int(Input("enter integer value"))
Valid = True
except:
...
0
votes
3
answers
94
views
distance of a point from the lines that are contained in a list
I am making a python animation for a project in which, I am taking a star shaped boundary in which there are two balls which are moving inside that star. If the balls collide to other balls, a new ...
0
votes
0
answers
34
views
pandas not discoverable for different users on the same computer
I want to share my code with other users on a single computer to ensure a backup of automated procedures.
The python files are all there and everything appears to be in order, but when a secondary ...
1
vote
1
answer
63
views
Do comprehensions in python call a function in the background?
I defined the following factorial function using recursion :
def factorial(n):
if n == 0:
return n
else:
return n*factorial(n-1)
Then, I defined the following function to ...
2
votes
0
answers
71
views
What exactly is recursion depth in Python? [duplicate]
From my understanding, when a recursive function is executed in Python, a stack is created internally, containing the function's calls. I assumed that the recursion depth is the number of functions in ...
0
votes
2
answers
27
views
Importing classes from different module levels causes typehint and argument warning disabling
I have this file structure:
- package
- sub_package_1
- __init__.py
- sub_module_1.py
- sub_package_2
- __init__.py
- sub_module_2.py
In sub_module_1.py we have this code:
...