Quantcast
Channel: Active questions tagged python - Stack Overflow
Browsing all 16921 articles
Browse latest View live

Dynamically importing libraries with importlib on setuptools entrypoint

What I am trying to achieveMy goal is, after installing the python package, to be able to run a command from a script that was not installed together.Example$ excommandHello!Directory Structure.├──...

View Article


Can ProcessPoolExecutor work with yield generator in Python?

I have a python script aiming to process some a large file and write the results in a new txt file. I simplified it as Code example 1.Code example 1:from concurrent.futures import...

View Article


.ipynb File | Jupyter Notebook via Anaconda | 403 Forbidden Error Code

I was working on something in Jupyter Notebook at work, saved it as .ipynb file and E-mailed it home hoping to work some more. However, when I tried to open it at home, it threw this 403 Forbidden...

View Article

buildozer not able to convert my kivy file into an apk file in google collab

[INFO]: Downloading openssl[INFO]: -> directory context /content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/packages/openssl[DEBUG]: -> running basename...

View Article

only use Bartmodel BartEncoder to replace seq2seq encoder(I'm an NLP kid)

In the seq2seq model, whether only the BartEncoder in the BartModel is used and the decoder uses its own definition, or whether the decoder in another seq2seq model is used. Is there a big guy who can...

View Article


how can I ensure that an awited function will happen before synchronous...

I'm using fastAPI with websocketI want to do a stream of responses from chatGPTthis is my websocket endpoint@srt_router.websocket("/ws")async def websocket_endpoint(websocket: WebSocket): await...

View Article

Adding interaction for my customed ipywidgets component

I used the ipywidgets to define a customed component in jupyter notebook, but when I adding interaction to my component, it can't work.The component class is:from __future__ import print_functionimport...

View Article

How to include an online forms in a sphinx-build website

I have a python package and website which is build with sphinx. I'm looking to include a page containing a form that can be filled:e-mail (*):question 1:question 2:...ValidateUpon validation, the form...

View Article


Image may be NSFW.
Clik here to view.

VSCode Django import warning

trying out the VSCode editor, but immediately ran into a problem. I have a django 2.0.5 installation in a virtual environment, however, the out of the box linter yells at me. This is one of the errors...

View Article


Langchain memory not working when using with chroma db

I'm trying to build a chatbot that uses a stored chroma db containing product information to make recommendations. The chatbot works fine to make a recommendation based on user input but then when the...

View Article

Is i possible to add reactions or edit tags in threads in forums with...

I have a discord bot that edits every new thread created to keep them organized on the same format, so whenever a new thread is created, it checks if it's on the correct format, and if it's not, it...

View Article

How to unify the response format in FastAPI while preserving Pydantic data...

In FastAPI, I am using SQLAlchemy and Pydantic to return data.@router.get("/1", response_model=User)def read_user(db: Session = Depends(get_db)):db_user = user_module.get_user(db, user_id="1")if...

View Article

Why does timestamp wrap around for `libevdev` events?

I've been playing around with python-libevdev and noticed that event timestamps seem to wrap around. For example, when I ran the following script:import libevdev as evwith...

View Article


Why does Python multithreading not work properly with sleep?

I am experimenting with simple HTTP servers and performance testing, using the http module.More specifically, I am using ab (Apache Bench) to test the number of requests per second with various...

View Article

How to create one dictonary using 3 lists

I am new to Python and need help creating one dictionary file using three lists.example:list 1 = ["private", "private"]list 2 = ["10.1.1.1", "10.11.11.11"]list3 = [ "sfc", "gfc"]my code:dict = {}for s...

View Article


How can I check if an instance of a class exists in a List in Python 3...

In Python 3, I have a list (my_array) that contains an instance of the Demo class with a certain attribute set on that instance. In my case, the attribute is value: int = 4.Given an instance of the...

View Article

Inconsistent column width when printing emojis with Tabulate

I am trying to print out emojis as a table using tabulate, but not getting the right alignment. How can I fix that?emojis = [['🍌', '🥕', '🥕', '🍎', '🍌', '🍎', '🦸'], ['🍌', '🍎', '🚫', '🚫', '🍎', '🚫', '🍎'],...

View Article


Need help converting dataframe to json format

I have a table which has some sample data as provided belowimport pandas as pddata = {"mode": ["single_table_list", "single_table_list", "single_table_list", "relational_table_list",...

View Article

Image may be NSFW.
Clik here to view.

Why is python script using the system environment even though virtual...

Running VS Code in Windows and Python 3.9xI created a new project folder and created a new virtual environment for this project. The first script I created is a .ipynb file (jupyter notebook), and it...

View Article

running a script in google-colab - throws back no results [closed]

good day dear coding ppl.well i have issues to get this runned in google-colabHowever, i did some checks - and tried using the cloudscraper module.For example:import cloudscraperimport pandas as pdfrom...

View Article
Browsing all 16921 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>