Latest Questions tagged Python 3.x

Browse all latest questions tagged Python 3.x

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...

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...

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...

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....

54
Votes
Published 28 Jun, 2022
Python - ValueError: Invalid RGBA argument: 'rgbkymc'

train_class = train_df['Class'].value_counts().sortlevel() my_colors = 'rgbkymc' #red, green, blue, black, etc. train_class.plot(kind='bar', color=my_colors) plt.grid() plt.show() I'm getting: Val...

15
Votes
Published 01 May, 2022
Python - Explicitly Define Datatype in Python Function

I want to define 2 variables in python function and define them as float explicitly. However, when i tried to define them in the function parameter, it's showing syntax error. Please help me get the...

55
Votes
Published 26 Apr, 2022
Python - Pip - Fatal error in launcher: Unable to create process using '"'

I installed python 3.5.1 via ampps and it's working. However, when i try to use pip, i get the following message: Fatal error in launcher: Unable to create process using '"' I already reinstalled a...

22
Votes
Published 29 Aug, 2022
Python - Vectorize Sequences explanation

Studying Deep Learning with Python, I can't comprehend the following simple batch of code which encodes the integer sequences into a binary matrix. def vectorize_sequences(sequences, dimension=10000)...

16
Votes
Published 27 Aug, 2022
Python - Can I import modules from thread in Python?

It all began last night when I was making a script that required 8 or so packages including pygame.mixer which on my computer importing this takes a few seconds. This meant that before the script e...

62
Votes
Published 27 Aug, 2022
Python - re.search().TypeError: cannot use a string pattern on a bytes-like object

import urllib.request import re f = urllib.request.urlopen('http://www.geekynu.cn/') html = f.read() title = re.search('<title>(.*?)</title>', html) print(title) #print(title.decode('utf...

100
Votes
Published 15 Aug, 2022
Python - Gunicorn won't start Flask app because "Application object must be callable"

This is maybe a Python noob question, but after having spent a whole day searching, I couldn't find a solution. I created a simple Flask application, here is an extract of the python_pgfutter_importe...

3
Votes
Published 29 Apr, 2022
Python - How to insert a value into SQLAlchemy TIMESTAMP column

I am trying to set value for timestamp column using SQLAlchemy, but I experience following error: column "timestamp" is of type timestamp without time zone but expression is of type numeric My tabl...

36
Votes
Published 26 Apr, 2022
Python - How to use 'User' as foreign key in Django 1.5

I have made a custom profile model which looks like this: from django.db import models from django.contrib.auth.models import User class UserProfile(models.Model): user = models.ForeignKey('User...

13
Votes
Published 29 Aug, 2022
Python - Why does Python allow out-of-range slice indexes for sequences?

So I just came across what seems to me like a strange Python feature and wanted some clarification about it. The following array manipulation somewhat makes sense: p = [1,2,3] p[3:] = [4] p = [1,...

27
Votes
Published 29 Aug, 2022
Python - Which column type has support for lists in sqlalchemy?

I'm currently setting up a database for solar active regions and one of the columns is supposed to get the region number which, for now, I have declared in the following way: noaa_number = sql.Column...