2,209,292 questions
0
votes
2
answers
53
views
python: vscode doesnt highlight direct import from module
When I attempt to import a module from a local package (from core import config), VSCode's syntax highlighting isn't working. When hovering over config, it shows "config: Any" (the editor ...
-8
votes
2
answers
88
views
How do I use pipenv? [closed]
I keep getting stuck in the terminal trying to execute the commands to install Django. This is what I keep on seeing.
$ pip install pipenv
Defaulting to user installation because normal site-packages ...
0
votes
2
answers
81
views
How to implement height() and count_leaves() functions in my Binary Search Tree (BST) in Python?
I am learning Binary Search Trees in Python and I have written most of the BST functions such as insert, search, find_min, find_max, and delete.
I only need help implementing the two functions:
...
Advice
0
votes
6
replies
103
views
Optimizing sys.stdout.write()
I am an amateur playing around with making simple games using Python and the Windows console through sys.stdout.write(). I am aware that this method of doing 'graphics' with printing ascii characters ...
Advice
0
votes
2
replies
45
views
Make these all apply to one function so that one plays but stops the one before it
How do i make these all apply to one function so that one plays but stops the one before it
#####
def rex_audio(self):
RexAud = SoundLoader.load('Rex.wav')
RexAud.play()
...
4
votes
2
answers
126
views
Algorithm to recursively search a dictionary or list and return the path of each found element
I keep almost solving this.
I've got a data set of python dictionaries that contain both lists and dictionaries that also contain lists and dictionaries.
I want to find all instances of a substring in ...
0
votes
1
answer
87
views
PyInstaller - It does'nt generate an .exe file
I'm using pyinstaller main.spec command. The main.spec file is the next:
# -*- mode: python ; coding: utf-8 -*-
a = Analysis(
['main.py', 'flujo.py', 'flujo_if.py', 'descarga_manual.py', '...
-1
votes
0
answers
43
views
Use Paramiko Channel with Psycopg [closed]
I have some queries for a postgreSQL db that I want to run with Python (and the psycopg3 package) running on my local machine against a remote server that I have to access via a jump server.
If the ...
-3
votes
0
answers
39
views
How to persist multi-step form data between views in Django without committing to DB? [closed]
One-line project/context.
Short description of the problem and constraints.
Minimal code: models, the two views, form classes, snippets of urls.py.
Exact observed behavior or error.
Alternatives ...
0
votes
0
answers
36
views
How to perform multiple "render()" calls with docxtpl without losing unresolved variables?
I’m trying to fill a .docx template using the docxtpl library in Python, but I need to do it in multiple steps, because I can’t load the entire context dictionary into memory at once.
The problem is ...
0
votes
0
answers
36
views
Pandas merge on one of two criteria [duplicate]
I have a table/df that holds a set of code and value pairs. The codes are a mix of old (legacy) and new codes due to process changes. I have a second table/df that holds the old codes, new codes, ...
-3
votes
0
answers
50
views
How does Python execute this for-loop step by step? [closed]
for i in range(1, 20):
print(i)
I want to understand:
What (1, 20) means
How Python updates value of i
Why the loop prints the number one by one
0
votes
0
answers
41
views
steps to develop a python package for use with only a local conda mirror [closed]
I have pure python code I want to convert to a package that I can install using conda. It will have dependencies that I need to satisfy using only custom conda channels, and it will be uploaded to one ...
-3
votes
0
answers
74
views
Wrong response for a log in in a website for an exam [closed]
I'm trying to find the good password of a website (fake facebook) for an exam.
I've used Python and Selenium to make a connection and put the mail and password in the website.My idea is to dynamically ...
1
vote
1
answer
52
views
Alt, Shift and Control key bindings in Tkinter
I am struggling with some key bindings in Tkinter.
In my application, to avoid having to make each widget get the focus prior to having the opportunity of capturing KeyPress events, I decided to use ...
3
votes
1
answer
98
views
rasterized, dpi, bbox_inches='tight' and axins mess up the plot in a pdf
When I run the code below, the plot in the PDF is messed up. The content of the plot and the colorbar are shifted down to the left, as shown in the attached screenshot of the PDF.
import matplotlib....
-4
votes
0
answers
56
views
Convert PDF to DOCX in Python with tagging, but superscripts (FN) are misrecognized as subscripts during the process
I was converting pdf to docx using python along with tagging the Paragraphs(for e.g. [P20],[B44] like this ), emphasis( which are <EM>, <EMB>... like this has to be tagged) but I'm unable ...
1
vote
0
answers
31
views
PyModbus server returns wrong register values
I'm learning PyModbus and facing an issue with register values being read incorrectly by the client.
Server stores values [16689, 39322] in holding registers
Client reads [39322, 0] instead
The ...
-1
votes
0
answers
32
views
Want to crawl Facebook Groups to fetch members data using python [closed]
I used some script to automate the member data collection but it get detected and denied permission.Any solution on that?
tried to bypass the bot but not able to do.
3
votes
2
answers
68
views
Font size in Python Pillow and Microsoft Word
I want to make images in Python Pillow with text, insert the images into a Microsoft Word document, and have the font size in the image match the font size in the document. How do I make the font ...
1
vote
0
answers
69
views
How to use multiprocessing with an asyncio process and a command line subprocess?
How would I be able to start a multiprocess when one of the tasks uses Asyncio and another task uses a subprocess to run?
Here is the main function:
import asyncio
import aioprocessing
import ...
0
votes
0
answers
32
views
Removing the box surrounding the down arrow of a ttkinter.ComboBox
I want to remove the box surrounding the arrow of a combobox, seen below
I am using ttkinter with the theme "Clam", and styling it like this:
combobox_style = ttk.Style()
...
Best practices
1
vote
0
replies
33
views
Conditionally select fixture in pytest
I have an ETL build with sqlalchemy. To test it, we are using postgres in a docker container through pytest-docker.
But because on some computer, spinning docker container takes some time, we also ...
Advice
0
votes
0
replies
46
views
List of paths and sizes to sunburst plot
I have the following data format:
foo0/bar0/a0/b0/c0 50
foo0/bar0/a0/b1 30
foo1/bar0/a0/b0 10
foo1/bar1 20
foo1/bar2/a0/b0/c0 20
foo1/bar2/a0/b0/c1 30
I'd like to create a sunburst plot out of this. ...
0
votes
0
answers
62
views
SqlAlchemy not using updated table name in join statement
I'm not exactly sure how to what is going on, but for our testing we rename the tables before we generate everything (ie schema.table_name is renamed to table_name_schema due to issues with how we ...