Latest Questions in Python

Browse latst posts in Python Category

25
Votes
Published 01 May, 2022
Python - How to get the localStorage with Python and Selenium WebDriver

What's the equivalent of: driver.get_cookies() to get the LocalStorage instead of Сookies?

16
Votes
Published 01 May, 2022
Python - Tkinter window says (not responding) but code is running

I have a program that runs a long process after you click an action button. As the process is running the root window will say that it is not responding even though I know the program is running in t...

10
Votes
Published 24 Apr, 2022
Python - Pandas DataFrame: normalize one JSON column and merge with other columns

I have a pandas DataFrame containing one column with multiple JSON data items as list of dicts. I want to normalize the JSON column and duplicate the non-JSON columns: # creating dataframe df_actions...

16
Votes
Published 04 May, 2022
Python - Getting Error 403 in Google Colab with Tensorboard with Firefox

I have a tfevent file already present on my Drive and I have successfully connected it to Google Colab. After searching within the issues of Tensorboard Github, I found that I had to set dom.serviceWo...

9
Votes
Published 01 May, 2022
Python - Python arabic encoding issue

i have a text with windows-1256 encoding. now i want to convert text from arabic(windows-1256) to utf-8 sample text : Óæí Ïæã ÈíåÞí result : سوي دوم بيهقي i use this code to decode and encod t...

21
Votes
Published 26 Apr, 2022
Python - Writing a connection string when password contains special characters

I'm using SQLalchemy for a Python project, and I want to have a tidy connection string to access my database. So for example: engine = create_engine('postgresql://user:[email protected]/database') The proble...

10
Votes
Published 06 May, 2022
Python - `UnencryptedCookieSessionFactoryConfig` error when importing Apex

I'm trying to use Apex and whenever I try to import it (or anything involving it) I get the following traceback: Traceback (most recent call last): File "<stdin>", line 1, in <mod...

75
Votes
Published 31 Aug, 2022
Python - Selenium clicking next button programmatically until the last page

hi I'm new to web scraping and have been trying to use Selenium to scrape a forum in python I am trying to get Selenium to click "Next" until the last page but I am not sure how to break the loop. an...

102
Votes
Published 31 Aug, 2022
Python - You must feed a value for placeholder tensor 'Placeholder' with dtype float

I'm a newer to tensorflow, I really don't know how to solve the problem. The code is like: Feed the train with values: sess.run(train_op, feed_dict={images: e, labels: l, keep_prob_fc2: 0.5}) Use...

72
Votes
Published 29 Aug, 2022
Python - fun clock streaming text with python and flask

Please help. What code would it take to make a simple text clock application with python and flask to demonstrate how flask streaming works? Ideally the app would show text time in place, overwriting...

8
Votes
Published 06 May, 2022
Python - How to install Poppler to be used on AWS Lambda

I have to run pdf2image on my Python Lambda Function in AWS, but it requires poppler and poppler-utils to be installed on the machine. I have tried to search in many different places how to do that...

12
Votes
Published 01 May, 2022
Python - ModuleNotFoundError: No module named 'gi'

I am trying to run the following program: import gi gi.require_version('Gst', '1.0') from gi.repository import GObject, Gst Bu I am getting: Traceback (most recent call last): File "applicatio...

66
Votes
Published 27 Aug, 2022
Python - gTTS error: saving as wav but saved as MPEG

Trying to convert the text to speech and save as wav file using gTTS module. my code: import gTTS text = "This is my text in the saving folder" tts = gTTS(text) tts.save('sample.wav') The file i...

66
Votes
Published 27 Jun, 2022
Python - AttributeError: 'module' object has no attribute 'audio_fadein'

I have used cx_freeze to build a python project into a single folder with an .exe and it's dependencies, but when I run the .exe I get the error: AttributeError: module 'moviepy.audio.fx.all' has no...

26
Votes
Published 01 May, 2022
Python - Alembic - sqlalchemy does not detect existing tables

I've asked a question (Alembic - sqlalchemy initial migration) on how to detect tables by using target_metadata = Base.metadata for alembic revision --autogenerate -m "initial migration" After...

96
Votes
Published 31 Aug, 2022
Python - Find substring of keyword using BeautifulSoup

I am trying to find out the url containing a string/substring in the <td> tag from a list of urls using BeautifulSoup. It works fine if the complete string is present but fails for a substring....

5
Votes
Published 01 May, 2022
Python - Convert airflow macro 'ts' into datetime object

I encountered a problem with converting the airflow macros reference 'ts' into a datetime object. The problem is with the tz at the end of the string. from datetime import datetime timetoday = kwargs...

71
Votes
Published 27 Aug, 2022
Python - Find rows of dataframe with the same column value in Pandas

Consider a dataframe with 2 columns for easiness. The first column is id and it is the key. The second column, named code is not a key but the case of two entries having the same value is very rare....

61
Votes
Published 20 Aug, 2022
Python - validated_data is empty when making POST request with Django REST

I'm trying to create a new entry in my database with Django REST framework and I am able to successfully send a request however validated_data is empty: # -*- coding: utf-8 -*- from __future__ import...

96
Votes
Published 31 Jul, 2022
Python - I am trying to import:from torchtext.legacy.data import Field, BucketIterator,Iterator,data, but get error 'No module named 'torchtext.legacy'

I am trying to execute the following code for a nlp proj import torchtext from torchtext.legacy.data import Field, BucketIterator, Iterator from torchtext.legacy import data ----> 6 from torchtex...