1,105 questions
-3
votes
0
answers
49
views
Python sys.exit() hexidecimal value [closed]
I am looking to set an exit code of sys.exit(2)
My issue is that, when I port this to a non-windows system, 2 actually translates to hexidecimal 200, which on this system is being returned as decimal ...
-4
votes
0
answers
39
views
Networked File Synchronization System [closed]
I want make client and server to sync file between each other , Now through socket I received (server) from client information about files my problem how I can distinguish if these name file or the ...
0
votes
1
answer
44
views
Using \r to overwrite a progress bar not working in Windows
I have this snippet of code that does not work. Well, it works fine, but it does not delete on my Windows computer. Please Help!
import time
import sys
def loading_bar(count, total, suffix=''):
...
1
vote
1
answer
53
views
How do I erase the last word printed onto the terminal?
I would like to be able to erase the last word printed onto the terminal. The last word should be the last string of text following a space. The following code simulates what I am trying to achieve. I ...
0
votes
0
answers
31
views
Setting sys.displayhook only works if it's ran at the same time as other commands
I'd like to have Spyder print newlines between commands, so I run this:
# Force Spyder to print newlines every command
def alwaysprint_displayhook(value):
if value is not None:
sys.stdout....
1
vote
1
answer
94
views
Can't change recursion limit python
sys.setrecursionlimit is set to 20000, but I get error because of "996 more times", despite setting limit to a bigger number
import sys
from functools import *
sys.setrecursionlimit(20000)
@...
-1
votes
1
answer
194
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
52
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
54
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
216
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 ...
2
votes
1
answer
103
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
211
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
48
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
62
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:
...