4,097 questions
1
vote
2
answers
150
views
How to make a copy of stdout that does not close?
I would want to copy sys.stdout such that it will not be closed.
There is some generic code that does:
def dosomething(fd: IO[bytes], input):
with fd as f:
for buf in input:
f.write(...
0
votes
0
answers
31
views
Why can't I implement ENERGYM?
I am trying to implement the ENERGYM library in Python as per the following paper: https://www.mdpi.com/2076-3417/11/8/3518 and https://bsl546.github.io/energym-pages/sources/install_min.html
After ...
-3
votes
2
answers
81
views
How to sum values across dicts?
I'm using python 3.7. I have a list of dicts that and I want to create a concatenated dict where that concatenated dicts sums over values (grouped by keys) per key in the initial list of dicts.
So e.g....
1
vote
0
answers
115
views
Failed Building Wheel for Scikit-fmm
noob here. I am currently trying to run this project: https://github.com/katsuma-inoue/soft_skeleton_solver
I was able to install all the listed packages, except scikit-fmm which keeps failing, with ...
0
votes
2
answers
140
views
Selenium - AttributeError: 'Service' object has no attribute 'get'
With this code below:
import requests, os
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
from webdriver_manager.chrome import ChromeDriverManager
...
1
vote
3
answers
3k
views
I cannot install bpy using pip
I'm trying to install bpy using pip install bpy. According to their website: https://pypi.org/project/bpy/, version 4.3.0 is the latest (and was released in November 2024). Is there any way of using ...
0
votes
1
answer
57
views
Rect() TypeError while converting from Python 2 to Python 3
I'm getting the weirdest error while converting an application from Python 2 to Python 3.
Briefly this application uses wxPython to create an interface where the user can draw different objects on a ...
-1
votes
1
answer
85
views
Dynamic type instantiation of Local class in Python 3.7
I'm trying to do some custom serialization/deserialization and must be able to handle custom data-classes, even local ones within functions. I found a question about this with a proper solution, but ...
1
vote
0
answers
50
views
Differences between pyenv and repo install for Python versions
If I install Python via pyenv, will there be conflicts if I previosuly used sudo apt-get install python3?
I have used pyenv to get a specific version (3.7.5) to revive an old project running in a ...
0
votes
0
answers
90
views
Python input() Function Not Accepting Keyboard Input or Returning on Enter
I'm running into an issue with the input() function in python 3.7.9. Under certain conditions, all keyboard input is no longer being reflected on screen and [ENTER/RETURN] key no longer submits the ...
1
vote
0
answers
46
views
Depth Search between CFGs in BFS algorithm using python with LLVM IR
Context: I am trying to find out the depth between two CFGs using BFS but the code is not properly working as it's only showing the results up to depth 0 and 1 but it's not showing the other depths ...
0
votes
1
answer
105
views
Can't install picos in Python 3.7
I am trying to solve a mathematical problem using python 3.7.0 . For this I've installed CPLEX 12.10 and I decided to install some dependencies, like numpy, prettytable and picos. Numpy and ...
1
vote
0
answers
360
views
session Crashing: while installing python version 3.7 and transformers version 4.6.0 in Google Colab
I am working on a project for Meta Review Generation. I have picked my base paper as "MReD: A Meta-Review Dataset for Structure-Controllable Text Generation", the code and the data are give ...
1
vote
0
answers
218
views
Cannot install required version of tensorflow-gpu
I am trying to install this Python package as per the instructions, resulting in this error: ERROR: Could not find a version that satisfies the requirement tensorflow-gpu==2.5.0 (from rascore) (from ...
-1
votes
1
answer
72
views
App Route with two parameters quit working with updated dependencies
I recently updated to a new version of flask/python/google app engine. I have the controller below.
@app.route('/area/entity/<int:video_id>/subentity/<int:collection_id>/', methods=['POST']...
0
votes
0
answers
120
views
ChatterBot not installed on IDLE 3.7.9
I've installed ChatterBot 1.0.0 (due to the unavailability of the other versions) with pip:
pip install chatterbot==1.0.0
and for some reason, IDLE is returning with this output:
Traceback (most ...
0
votes
1
answer
913
views
Python 3.7 equivalent of `importlib.resources.files`
I have an application that unfortunately does not support Python past 3.7. I have some code I'm trying to port (from Python 3.12) back to Python 3.7 that uses importlib.resources.files to get the path ...
-1
votes
2
answers
129
views
Having multiple issues for installation of Multiple version of Python
I have three versions of python
3.9.11
3.11.8
3.12.2
I have installed all the versions.
Now when I am trying to check all the versions of python I installed using commands
py -0 #Doesn't Working
...
0
votes
0
answers
77
views
Fitsio Python Package Import Error - undefined symbol: fits_use_standard_strings
I am trying to import fitsio version 1.2.1 on python 3.7.0. However, I receive the following error "ImportError:
/home/apc44/anaconda3/envs/pylab_py37/lib/python3.7/site-packages/fitsio/...
0
votes
1
answer
436
views
Unable to import BatchNormalization from tensorflow.python.keras.layers
I am trying to run a project. My TensorFlow version is 2.9.2. I need to import BatchNormalization, but I cannot import it. Here is the error message: AttributeError: module 'tensorflow.python.keras....
2
votes
1
answer
467
views
Using subprocess.run caused script to hang
First time asking a question here.
So I have been task to create a script that checks if a device is reachable via ping. Just liek to point out that I was able to create a working script on my laptop ...
1
vote
1
answer
87
views
pandas import as pd fails with"UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb0 in position 14: invalid start byte"
The error occurs at the import statement on a Raspberry Pi
(Linux rp3b 5.10.17-v7+ #1414 SMP Fri Apr 30 13:18:35 BST 2021 armv7l GNU/Linux
) before doing stuff. What's wrong here?
#!/usr/bin/python3
# ...
0
votes
0
answers
67
views
Python PIL UnidentifiedImageError
**I'm trying to upload an image as base64 to a database on pythonanywhere, and be able to retrieve those images and display them.
I have this code, which works completely: **
root = tk.Tk()
root....
-1
votes
1
answer
433
views
subprocess error while installing aiohttp==3.8.1 and setproctitle==1.1.10 on mac
I am trying to run a local already done django project but I get this subprocess error while trying to install these to packages. I'm using python3.7 and my device is mac OS. These are the main errors:...
0
votes
1
answer
220
views
Unable to find 'endstream' marker for obj starting at 13367
When executing this piece of code:
from pypdf import PdfReader,PdfWriter
import traceback
try:
input_pdf = PdfReader(dwnld_filepath)
output_pdf = PdfWriter()
image = input_pdf.pages[0]
...
0
votes
1
answer
498
views
Error installing python3.7 on ubuntu 16.04
I'm trying to install Python3.7 on ubuntu 16.04. I tried the installation steps on the internet, but I got an error code.
My installation steps:
sudo apt update
sudo apt install software-properties-...
2
votes
1
answer
215
views
Why does conda install non-compatible jupyterlab dependency (prometheus_client) in my environment?
I am running conda via a standard miniconda3 installation on Ubuntu 20.04. I need a Python 3.7 environment and have the following simplified conda environment file (test_env.yaml):
name: test-env
...
0
votes
1
answer
144
views
Using Mixer to Play Mp3 Throws Error About libmpg123-0.dll, but There's No Context
I wanted to play a .mp3 file to my microphone using python code that I found in a Stack Overflow post, but I had to do some tweaking with the steps I had to take.
Here are the steps that I had to do:
...
0
votes
1
answer
490
views
ModuleNotFoundError: no module named XY
ModuleNotFoundError: no module named XY
XY is the cloned repository
The above error is a result of the import statement at the beginning of the training file.
I have cloned a repository from GitHub ...
0
votes
0
answers
288
views
Is there a module like lib2to3 that could update Python scripts written for 3.7 to be compatible with 3.12?
I have over 100 scripts that are not compatible with 3.12. While technically possible to complete manually, this would be quite time intensive. Is there something like lib2to3 that can update these ...
0
votes
1
answer
598
views
Getting error while installing py2exe for python 3.7.9 version
I am using Pycharm on Windows 10 and needed to install py2exe package. So I tried to install it with the github repository "https://github.com/lambacck/py2exe-3 ". I don't know what is the ...
2
votes
1
answer
212
views
getting exact match for list of columns name from files
I have created a script where I read from a list of column names that need to be deleted and specified a list of directories to scan for the sql and python files to find a match using the python - ...
0
votes
1
answer
164
views
Why is Python's subprocess output different than cmd's of a PTC command?
Im using Python 3.7 and the im viewissue <itemID> command of Integrity Client 12.5. When I query and item using this in cmd, I get every detail perfectly decoded, no unknown bytes or hexadecimal ...
0
votes
0
answers
296
views
Python39 and pymysql
I've just tried upgrading up to python3.9.5 from 3.7 and I'm encountering a strange behavior that I can't quite nail down. It involves pandas1.3 and pymysql1.1.0. The strange part is that the ...
1
vote
1
answer
69
views
Attribute error in sending email through smtp in python 3.7
I have hidden id and password in this question. But, gmail password was generated after
turning on 2 step verification and generating an app password.
ERROR--
AttributeError: module 'smtplib' has no ...
4
votes
1
answer
234
views
How to statically protect against str == enum comparisons?
More often than not, I make the following mistake:
import enum
class StatusValues(enum.Enum):
one = "one"
two = "two"
def status_is_one(status: str):
return status == ...
0
votes
1
answer
191
views
PyInstaller (ImportError: cannot import name 'jwt' from 'jwcrypto')
Good morning.
I have an application in Python 3.7 which uses several libraries and files that has the following structure:
app2:
- Blockchain
- db
- secrets
- smartcontrats
- utils
- menu....
2
votes
1
answer
4k
views
How do I install Python3.7 on Ubuntu 16?
I tried this approach but got:
add-apt-repository ppa:deadsnakes/ppa
Error processing line 1 of /usr/local/lib/python3.5/dist-packages/distutils-precedence.pth:
Traceback (most recent call last):
...
-3
votes
1
answer
453
views
import cv2 --- ImportError:DLL load failed:
I got this error message while trying to run my main.py:
Traceback (most recent call last):
File "main.py", line 5, in <module>
from preview import generate_preview_image
File "...
0
votes
0
answers
587
views
What reasons could make psycopg2 mismatch a ca cert that datagrip accepts?
I want to make a python application that connects directly to the database. I got it to work with ssl required, but setting it to verify CA the connection fails. In datagrip, I checked the 'use ssl' ...
1
vote
2
answers
2k
views
How to delete the _MEI file in C:\Windows\Temp generated by running the exe program packaged by python
I run multiple python-encapsulated exe programs on the server. After the environment resources of each program are released, there are about 20 G, which causes the C drive to be full. I try to delete ...
0
votes
2
answers
66
views
Error when tryig to login to account with gd.py
I'm trying to login with this library of python. Here is code what I tried.
Python
import gd
def _session_(username, password):
try:
client = gd.Client()
client.login(username, ...
0
votes
0
answers
89
views
How can I change the background color for every second column in Tkinter, treeview?
I need to change every second column's background color.
columns = ('ID', 'type', 'name', 'CECQ code', 'QR code', 'location', 'placement', 'edition date', 'description', 'Check')
listBox = Treeview(...
0
votes
0
answers
185
views
NameError: name “x” is not defined
> import tkinter
> import tkinter as tk
> from tkinter import ttk
> from tkinter import messagebox
> import sqlite3
# CREEAREA APLICATIEI + CONFIGURAREA ACESTEIA
root = tk.Tk()
root....
1
vote
1
answer
2k
views
How to persist the charts I made through pygwalker?
I am using Pygwalker to create some charts for my analysis, but I am unable to save the charts I have created.
Every time I reopen the notebook or refresh the notebook page, the charts I made before ...
0
votes
1
answer
148
views
One time load Word2Vec from Memory
I`m loading the Word2Vec models with the code below:
model = gensim.models.KeyedVectors.load_word2vec_format('cc.en.300.vec',binary=False,encoding='utf8')
return model.wv
It takes over 10 minutes ...
1
vote
1
answer
941
views
WinError 2 While installing smbus package via pip
While Installing smbus The Same error kept occuring which was [WinError 2] The system cannot find the file specified
i am using python 3.7 and i am wondering why this error is occuring to install it i ...
1
vote
0
answers
169
views
How to resolve "The 'pip' distribution was not" when using pyenv on Mac
I'm attempting to install codalab worksheets cli. I have a Mac M2 machine, with a python version 3.10 installed through homebrew. I tried just pip installing the codalab package, but it didn't work ...
0
votes
1
answer
98
views
Tkinter frame class using OOP not showing parameters e.g. background colour (bg="black etc.)
I am new to OOP with Tkinter but have made some applications implementing minimal OOP from Tkinter - the classic frame1 = Frame(root, bg="black") rather than using classes.
I have tried many ...
0
votes
1
answer
558
views
how to use Python multimethod with custom class as argument type
I have the following classes setup:
class A:
pass
class B(A):
pass
class C(A):
pass
Then I have a method that gets called with 2 arguments:
x -> always a string
y -> one of the ...