We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [python-3.x]

For questions about Python programming that are specific to version 3+ of the language. Use the more generic [python] tag if your question is not version-specific. Use the [python-2.x] tags for Python 2 questions.

65,476 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
27
votes
0answers
2k views

Access Lovoo API using Python

I am hoping to make use of the lovoo API, but don't really know how to start. After running Charles proxy and looking at the traffic, I have come to the following conclusion: First a GET to https://...
24
votes
0answers
341 views

Description of TF Lite's Toco converter args for quantization aware training

These days I am trying to track down an error concerning the deployment of a TF model with TPU support. I can get a model without TPU support running, but as soon as I enable quantization, I get ...
18
votes
0answers
804 views

Running asyncio loop engine using external python plugin

I have installation of uWSGI that is running in emperor mode. Vassals are using different python versions, so I can't have python plugin embedded in uWSGI binary. Having that, I want to use asyncio ...
17
votes
1answer
657 views

How pytorch's parallel method and distributed method works?

I'm no expert in distributed system and CUDA. But there is one really interesting feature that PyTorch support which is nn.DataParallel and nn.DistributedDataParallel. How they are actually ...
14
votes
0answers
268 views

aiogevent event loop “fails” to track greenlets

I recently stumbled onto problem of mixing up gevent and asyncio-based code, because some synchronous libraries work just fine when I monkey-patch them with gevent.monkey.patch_all(). I found the ...
14
votes
0answers
238 views

Accepting output of the socket generated by Python in MQL5

I have created a socket file something like the following and want that the output of the socket must be read by the MQL5. See the following python code; daemon.py import socket #import arcpy def ...
13
votes
0answers
1k views

Cannot load backend 'Qt5Agg' which requires the 'qt5' interactive framework, as 'headless' is currently running

I am trying to use Qt as matplotlib backend. i have checked it both on kaggle and google colab, but problem is same. When i write %matplotlib qt5 i got following error ImportError: Cannot load ...
13
votes
0answers
164 views

Mayavi colorbar in TraitsUI creating blank window

I'm trying to create a GUI in TraitsUI that includes two Mayavi figures. I have implemented these figures as per the multiple engines example in the Mayavi documentation. However, when I add a ...
13
votes
2answers
1k views

How to debug dying Jupyter Python3 kernel?

I'm running some code using scipy and scikits.learn on Jupyter notebook using Python 3 kernel. During the computation the kernel is being restarted with a message dialogue saying that “The kernel ...
13
votes
2answers
4k views

How to write a custom JSON decoder for a complex object?

Like the title says, I'm trying to write a custom decoder for an object whose class I've defined which contains other objects who class I've defined. The "outer" class is an Edge, defined like so: ...
13
votes
3answers
825 views

Efficient calculation of euclidean distance

I have a MxN array, where M is the number of observations and N is the dimensionality of each vector. From this array of vectors, I need to calculate the mean and minimum euclidean distance between ...
13
votes
1answer
4k views

open ai gym Nameerror

I am trying to use the famous 'Gym' module from OpenAI on WSL and executing code on python 3.5.2. When I try to run an environment as explained here, using the code: import gym env = gym.make('...
12
votes
1answer
1k views

Nesting concurrent.futures.ThreadPoolExecutor

I have a program where I am currently using a concurrent.futures.ThreadPoolExecutor to run multiple tasks concurrently. These tasks are typically I/O bound, involving access to local databases and ...
11
votes
0answers
532 views

Aws Lamda : OpenBLAS WARNING - could not determine the L2 cache size on this system, assuming 256k - While using Google Custom Search API

I deployed the google custom search API as AWS lambda function for my project. It uses the 3GB (full memory provided by lambda) and task got terminated. It throws a warning : "OpenBLAS WARNING - ...
11
votes
1answer
403 views

Handle Turkish uppercase and lowercase correctly, need to modify/override built-in functions?

I am working with multilingual text data, among others with Russian using the Cyrillic alphabet and Turkish. I basically have to compare the words in two files my_file and check_file and if the words ...
11
votes
1answer
410 views

Axis label hidden by axis in plot?

I am trying to make a polar 'sypder' plot but I am having some problems with the axis labels. The xaxis tick lables always seem to end up on a layer below the y axis grid (the letters are covered by ...
11
votes
2answers
4k views

Pytest KeyError when attempting to access a command line variable

I've re-created the question with a new simpler fake-setup. I have a framework that needs a command lane variable from pytest. This variable is called environment but when I attempt to access that ...
11
votes
2answers
974 views

How to exclude *.pyc and __pycache__ from python wheels?

What's the correct way to exclude files from a python wheel distribution package? Editing the MANIFEST.in does not have any effect and I can't find information about this detail.
10
votes
0answers
3k views

RuntimeError: empty_like method already has a docstring

I am working on a project that was developed using python 3.6 and I am using python 3.7 instead. I tried to run the tests that passed. However in the end I got a series of errors like this one: Error ...
10
votes
1answer
305 views

ModuleNotFoundError if I import pandas before pyplot

I ran into a weird bug this morning that I'm hoping to get some background info on. I have a work around, but I'd like to know if there is some deeper issue. I could not find anything on SE or ...
10
votes
1answer
1k views

Why `sklearn` and `statsmodels` implementation of OLS regression give different R^2?

Accidentally I have noticed, that OLS models implemented by sklearn and statsmodels yield different values of R^2 when not fitting intercept. Otherwise they seems to work fine. The following code ...
10
votes
0answers
681 views

Python - How to send an email with attachment without loading the whole file into memory at once?

I would like to send emails with attachments of 10MB or more in a VPS with low RAM; the usual way to send an email with attachments in Python 3 (that I have found) is this: from email.message import ...
10
votes
0answers
305 views

Calling a JS File Within Jupyter Notebook & Sharing Data

I'm interested in placing a javascript powered graph into my jupyter notebook file as a div. This website uses a code magic approach, and pasting the graph code directly in a jupyter notebook cell: ...
10
votes
0answers
350 views

Conflict between Pandas and Unittest?

Consider the following block of code (developed inside a Jupyter notebook), for which it is expected that an AssertionError is raised because a UserWarning is not triggered: %%writefile Game/tests/...
10
votes
2answers
3k views

Can't compile Python using Nuitka

I'm trying to compile Python file which uses urllib.request, BeautifulSoup, and webbrowser. $ nuitka python.py Nuitka:WARNING:python.py:16: Cannot find 'urllib.request' as relative or absolute import....
10
votes
2answers
2k views

How to send and receive some data via a GSM modem during an active call (Python and AT Command)

I wrote the below Python program to communicate with my D-Link DWM-156 GSM modem. This program wait for incoming calls and as it receive a RING alert, it accepts that call. Fortunately it works fine ;...
10
votes
2answers
3k views

OS X cmake can't find PythonLibs 3.4

python and python3 are installed in OS X Yosemite via Homebrew, but cmake fails to find PythonLibs 3, only 2: CMakeLists.txt: set(Python_ADDITIONAL_VERSIONS 3.4) FIND_PACKAGE(PythonInterp REQUIRED) ...
10
votes
1answer
709 views

Failure to find module in split namespace

I am working with Python 3.3.1 64 bit on Ubuntu 13.04 64 bit running under Eclipse 4.3 64 bit with Pydev 2.7.6 in a virtualenv environment. I have my project in the following directory structure. ...
9
votes
0answers
182 views

Message sequence acting unexpectedly in RabbitMQ

I'd like to implement a RabbitMQ topology similar to Option 3 here, except for some differences: The new topology should handle a few 1000 messages per day. And it shall have two exchanges: one to ...
9
votes
0answers
711 views

Putting .SVG images into tkinter Frame

I have been trying to put the image from https://betacssjs.chesscomfiles.com/bundles/web/favicons/safari-pinned-tab.f387b3f2.svg into a Tkinter frame. I found from the post here that it is possible ...
9
votes
1answer
206 views

How do I run a single nosetest via setup.py in the python-active-directory module?

I am stubbornly trying to convert the Python module https://github.com/theatlantic/python-active-directory to Python 3. You can see my efforts here https://github.com/nbmorgan/python-active-directory/...
9
votes
0answers
342 views

How to solve multiprocessing stop working problem in Python 3.7.2 using venv

2019-01-12 Update I reinstalled python 3.7.1 and remade venv to get everything back to work. But still, I am unawrae of what happens in 3.7.2. I have been using multiprocessing.map_async and ....
8
votes
2answers
2k views

Conda create is stuck at “solving package specifications”

I'm trying to create a Python 2.7 virtual environment with Anaconda so I can download some packages that are not compatible with Python 3.4. I'm working in Conda version 4.2.13. When I type the ...
8
votes
0answers
307 views

OpenCV: Illegal Instruction 4 when trying to instantiate VideoCapture with path

I have the following code: cap = cv2.VideoCapture("/full/path/to/video.mp4") When I run it on MacOS 10.11.6 with Python 3.6 and 3.7, the program stops with the error message Process finished with ...
8
votes
1answer
210 views

Parameters shooting to infinity while training after some epochs

I'm implementing Linear Regression in Tensorflow first time. Initially,I tried it using linear model but after few iterations of training, my parameter shot up to infinity. So, I changed my model to a ...
8
votes
0answers
627 views

How to reduce the palette of PNG image in Python/Pillow to the colors being really used?

After processing a previously optimized indexed color PNG image with transparency (see here for some background, since this question refers to the same image file), using the following code, the PLTE ...
8
votes
1answer
2k views

Could not deserialize key data with python3

I'm trying to send a public key to a server built with python and i'm getting the following error while calling load_pem_public_key key = serialization.load_pem_public_key(pem_data,backend=...
8
votes
1answer
265 views

Reading joystick capability

I'm trying to read my joystick capability by using the winmm.dll library. Here is how I'm doing it... from ctypes import windll, Structure, c_uint, c_ushort, c_char, c_ulong WORD = c_ushort UINT = ...
8
votes
3answers
384 views

ValueError: Cannot serialize function: lambda while using makemigrations

When I do python manage.py makemigrations, i get above error and I am unsure where the error is happening. I saw some post regarding this issue but i find mainly in DateTimeField() where the function ...
8
votes
3answers
2k views

Headless chrome with python suspends when trying to download a file

I'm using Python, Jupyter, Selenium webdriver and headless chrome (with Canary) on Mac. I wrote a script that scrapes a very old website, In order to download a file from that website I need to click ...
8
votes
0answers
125 views

Randomizing network using pymc in Python

There are two columns in the dataset, user_id, and site_name respectively. It records every site name that every user browsed. toy_dict = {'site_name': {0: u'\u4eac\u4e1c\u7f51\u4e0a\u5546\u57ce', 1: ...
8
votes
0answers
327 views

Deploying my PyQt5 app to Android

I have written an PyQt5 app with Python 3.6 on Windows, the app is working perfectly on Windows, I used PyInstaller to make one .exe file to run the app, which works great! Is it possible to make my ...
8
votes
1answer
2k views

Selenium Webdriver - tried to run command without establishing a connection

I'm new to selenium webdriver. I wrote a unittest script and ran it on 2 different windows 10 machines. On the first machine the code ran without any errors. When I run the code on the second machine,...
8
votes
1answer
452 views

A simple way to insert a table of contents in a multiple page pdf generated using PdfPages

I am using Pandas to read data from some datafiles and generate a multiple-page pdf using PdfPages, in which each page contains the matplotlib figures from one datafile. It would be nice to be able to ...
8
votes
2answers
2k views

How can I use tkinter to prompt users to save a DataFrame to an Excel file?

I'm new to Python and programming in general. I'm trying to build a GUI for some code I wrote that imports data from Excel, does some analysis, then exports the new data from the DataFrame to another ...
8
votes
1answer
545 views

How to parse only a specific category of a website using the newspaper library?

I use Python3 and the newspaper library. It is said that this library can create a Source object that is an abstraction of a news website. But what if I need only the abstraction of a certain category....
8
votes
1answer
484 views

Pympler summary doesn't seem to make sense

I'm doing some sanity checks with Pympler to make sure that I understand results when I try to profile an actual script, but I'm a bit puzzled at the results. Here are the sanity checks I've tried: ...
8
votes
1answer
619 views

“ModuleNotFoundError: No module named 'pysqlcipher3'” error while using Python 3.7 on windows 10

I am trying to decrypt one database file by using python 3.7. So to decrypt it I have to use pysqlcipher3 version for python 3.7. To install it I have tried by using both commands: pip3 install ...
8
votes
1answer
94 views

Python3 unexpected visual interaction with input function and CJK

Sorry for my poor English, it is not my first language. I have a Python3 file whose content is just print(input(">")) When I run it on either zsh or bash and write hangul and use my backspace ...
8
votes
1answer
9k views

OSError: [Errno 22] Invalid argument in python3 socket

I have a problem with socket programming in Python 3. I get an exception that is not making the program crash, but is just shown in terminal. Here is my code: from PyQt4 import QtCore, QtGui from ...