How to fix column calculation in Python readline if using color prompt

I use standard tips for customizing interactive Python session: $ cat ~/.bashrc export PYTHONSTARTUP=~/.pystartup $ cat ~/.pystartup import os import sys import atexit import readline import...

python win32print not printing

I need to print some information directly (without user confirmation) and I'm using Python and the win32print module. I've already read the whole Tim Golden win32print page (even read the...

improving speed of Python module import

The question of how to speed up importing of Python modules has been asked previously (https://stackoverflow.com/questions/2010255/speeding-up-the-python-import-loader and...

apache2 and mod wsgi : Target WSGI script cannot be loaded as Python module

I am trying to install mod_wsgi on apache2, on ubuntu. So I install libapache2-mod-wsgi package, I activate him with a2enmod. I got a web site (languageAnalyz), that I am trying to use with...

Django [Errno 13] Permission denied: '/var/www/media/animals/user_uploads'

I am developing a django API which will be running on top of Apache2 via WSGI on a server running Ubuntu. Users will be able to upload pictures they take to the server using a POST request. The...

Configure options for building MinGW-64 on linux-64 for linux-64 (ultimately targetting windows-64)

I want to build MinGW-w64 where: A: I want to compile MinGW itself on Linux (64-bit). B: I want the MinGW tools (compiler, etc) to run on Linux (64-bit). C: I want the MinGW tools (compiler, etc)...

Open web in new tab Selenium + Python

So I am trying to open websites on new tabs inside my WebDriver. I want to do this, because opening a new WebDriver for each website takes about 3.5secs using PhantomJS, I want more speed... I'm...

PyQt: Force popup window to be at the front

I have a simple popup about window in my application. It has a button "Ok" which closes the about window. I want to make that window exitable only via the "Ok" button so you wouldn't be able to...

Find files in a directory containing desired string in Python

I'm trying to find a string in files contained within a directory. I have a string like banana that I know that exists in a few of the files. import os import sys user_input = input("What is the...

Does __init__.py have to be in every directory of python application?

__init__.py are use to mark directories on disk as a Python package directories. lets say we have the files py/src/__init__.py py/src/user.py and py is on your path, you can import the code in...

How to open a new webpage with selenium (and close the older) in Python?

I want to do some web-scraping from a website with selenium in Python 2.7, wait a little bit, and after close the browser + close the geckodriver.exe (because I don't want to open millions of...

Apache Ignite Fabric 2.1 crashes on start

I am new to Apache ignite and trying to run it on my local machine.While executing bat file for Ignite,i am getting error related to Out Of Memory.How can i resolve it?.Ignite launches but crashes...

numpy is already installed with Anaconda but I get an ImportError (DLL load failed: The specified module could not be found)

I am using the Anaconda distribution with Python 3.7. Among the packages installed, I have numpy, pandas, etc. In PyCharm IDE, I have set the Project Interpreter to be the path to the python.exe...

unable to deploy scrapy to scrapyd server

I am trying to deploy my scrapy which connected to django project to scrapyd, but when I tried scrapyd-deploy JD -p JDSpider, it failed. It said No module named GradutionProject. It seems the...

How to do post-mortem debugging within Django's runserver?

I am currently debugging a Django project which results in an exception. I would like to enter the ipdb post-mortem debugger. I've tried invoking ipdb as a script (cf....

Keras GPU memory overflow using with keras.utils.sequence and generator

Dataset.py import os import random from skimage import io import cv2 from skimage.transform import resize import numpy as np import tensorflow as tf import keras import Augmentor def...

Convert doc/docx to pdf in AWS Lambda?

Tried: Premade Lambda application docx to pdf (the application is no longer deployable) https://github.com/NativeDocuments/docx-to-pdf-on-AWS-Lambda Installing comtypes.client and win32com.client...

How do I deploy a FastAPI application on cPanel?

I'm trying to deploy FastAPI application on cPanel, but I am clueless to start Unicorn. Below is my main.py file code. from fastapi import FastAPI app = FastAPI() @app.get('/') async def...

How to turn off logging for SqlAlchemy db pool only, when debugging is enabled in Python Django?

Context / environment I have a Python Django project connecting to a PostgreSQL database with a SqlAlchemy django-postgrespool2 db pool. What I'm trying to achieve In settings.py I have set DEBUG...

Error in "from keras.utils import to_categorical"

I have probem with this code , why ? the code : import cv2 import numpy as np from PIL import Image import os import numpy as np import cv2 import os import h5py import dlib from imutils import...

Unable to install detectron2 on Windows 10

I am using a windows 10 machine with the following configuration NVIDIA GeForce GTX 1650Ti miniconda3 python 3.8 CUDA 11.1 PyTorch 1.8 downloaded directly & installed from PyTorch.org for...

"Environment variable PYSIDE_DESIGNER_PLUGINS is not set, bailing out."

I have installed open source qt creator (free version) and creating very simple desktop application. I am able to create simple window but when I am running I am getting following error: I have...

How to convert python kivy app loader in to exe?

I tried most of the solutions in the web however none of them is working. I have tested pyinstaller, py2exe, cxfreeze none of this works when compiled on windows. However when I compiles it with...

How to curve text using Matplotlib in Python?

I'm trying to add the curved text to the Gauge plot using matplotlib import os, sys import matplotlib import seaborn as sns from matplotlib import cm # from matplotlib import pyplot as plt import...

pip unable to install Scipy (or anything) (Python 3.10)

I've been trying to download a lib called simpful. But I was just about start to python and I think I am missing something very basic. I searched for some sort of solution online for so long...

PIP failed to build package cytoolz

I'm trying to install eth-brownie using 'pipx install eth-brownie' but I get an error saying pip failed to build package: cytoolz Some possibly relevant errors from pip install: ...

error in installing dlib library in python 3.10

when install dlip library for face scan in python 3.10 this error hapend oder librarys dont have problem Microsoft Windows [Version 10.0.19043.1348] (c) Microsoft Corporation. All rights...

Unable to run vscode's debugger with dockerized django project

Every time when I run a debugger there happen many things but not what I expect. I'm running a project with docker-compose up Checking the localhost if backend backend is okay. It's down. What's...

Why does an ANN validation accuracy oscillate?

The following training curve is generated using the same Tensorflow + Keras script written in Python: RED line uses five features. GREEN line uses seven features. BLUE line uses nine...

coverage.misc.NoSource: No source for code: '/usr/src/server/rep-1>'

I am using the coverage package for quite a while now and it functioned well until yesterday it just fails at the level of generating a report I believe. There were no changes on how the...