2,206,800 questions
2
votes
0
answers
34
views
Python/numpy - 2D FFT does not recover the analytical solution
I am working on a code that calculates the 2D FFT of a function as a first step. I am testing it with the function exp(-r)/r, with r=sqrt(x²+y²) which has the analytical Hankel transform of 1/sqrt(r²+...
0
votes
0
answers
18
views
I can't get OBS to connect via websocket using a Python script
I am getting the error: No connection could be made because the target machine actively refused it
Here is my obs websocket settings:
obs websocket settings
import obsws_python as obs
from subprocess ...
Best practices
0
votes
4
replies
33
views
i want to practice python problems without dsa so is anyone can prescribe me any source
how are you
My name is kk i am learning Python from YouTube. I will watch approximately full tutorials, but I didn't remember some things. I know these things are removed by practice, but I can't find ...
Advice
0
votes
4
replies
62
views
In Python while unsing the PIL pillow library. When I open an image and call load on it do it still need to close it?
EDIT:
It seems like i was confusing closing of the image file with .close() destroying the image data. Memory shouldn't be the problem rather properly closing the file.
When opening a image in Python ...
-7
votes
2
answers
92
views
How can I break out of a loop within a function and return to my main program? [closed]
I'm working on creating a kind of online library. I'm using SQLite3 with Python, and basically I can add, delete, view my library, and search for books.
But if I select the search option, I can search ...
Best practices
0
votes
6
replies
46
views
Is there a simple way to take bitwise-and of a pandas series?
I have a pandas series of a bunch of 32 bit integers, and I'd like to roll through with series.rolling and get the bitwise-and of all the values in the window, basically trying to do this except that ...
-4
votes
0
answers
103
views
Rounding error in Python: np.floor(math.log(1000,10)) results in 2 instead of 3 [duplicate]
When I do np.floor(math.log(1000,10)) or np.floor(math.log(1000)/math.log(10)), the result I get is np.float64(2.0), when the result should be 3.
This is caused by the fact that when I do math.log(...
1
vote
1
answer
47
views
tkinter second window pops up automatically before button is pressed
I assumed that if statement would mean that the user was required to press the button for the program to check if a non-float or non-int was entered in entry to trigger another window to open but it ...
-1
votes
0
answers
54
views
PyTorch SRGAN Training Extremely Slow on CPU for Image Super-Resolution – How to Optimize? [closed]
I am working on the Plant Leaves Super Resolution challenge using PyTorch. I built an SRGAN-based model with Generator and Discriminator networks for image super-resolution.
The model takes low-...
Best practices
0
votes
5
replies
69
views
Python ast.literal_eval: raw strings recommended?
If I do something like
>>>import ast
>>>testinput = "\S"
>>>something = ast.literal_eval('"'+testinput+'"')
Warning (from warnings module):
File "...
-1
votes
0
answers
89
views
Running a python script from a web browser throws "execve: no such file or directory" [closed]
I have a web page that has an AJAX call to a Python script on my web server, but when I run it, the call returns that a 500 error was thrown. When I enter the URL to the Python script directly, it ...
0
votes
0
answers
56
views
Cartopy with Robinson projection?
I am new with Python and try to get the follow code to run.
from matplotlib.ticker import AutoMinorLocator
fig, (ax) = plt.subplots(nrows=1, ncols=1, figsize=fig_size_single_golden, ...
Advice
0
votes
2
replies
53
views
Get a datetime object to specify an instant for every timezone
How do I make a datetime object that doesnt convert the instant itself instead it adapts to the timezone and shows the equivalent of an instant with only a single datetime object on a fixed timezone.
...
Best practices
0
votes
3
replies
51
views
Is it safe to auto-generate Alembic migrations in CI/CD pipeline for a shared database?
I have a Python application using Postgres. The application connects to a shared AWS-hosted database for development.
I’m considering introducing a workflow where:
During the CI/CD pipeline run, ...
-7
votes
0
answers
48
views
Bugs in pyttsx3, cannot initialize [closed]
Help! I can't initialize it!
Something has __pycache**__** and these errors found!
import pyttsx3
engine = pyttsx3.init()
AttributeError: module 'pyttsx3' has no attribute 'init' (consider renaming '...