I am trying to create a new python 3.7 virtual environment on my local computer running Windows 8. I have python versions 3.6, 3.7, and 3.8 installed. Their exe’s are named python36, python37, and python, respectively. All three are correctly added to PATH because I can enter each interpreter. Within my new project’s directory I tried to create a virtual
Tag: python-3.7
How to avoid zipfile error with python-pptx saving files
I am using the python-pptx package to create a number of .pptx files from a series of dataframes. All works well with adding slides and such until it comes time to call prs.save() where “prs” is the Presentation. Doing so leads to a zipfile error re: open handles needing to be closed. I have done some research on the history
How to structure azure functions python project
I’m messing around with Azure Functions with Python and running into issues with getting a proper project directory structure. My goal is to have a library directory that I can put all the business logic in and then reference that from the functions entry point and also have a test directory that can test the functions and the library code
Fatal Python error: Cannot recover from stack overflow. In python
I was trying to make my own terminal and when I was adding the feature to make your own functions and use them I got this error: EDIT: For everyone looking for help with a similar error, this problem is caused by a function calling itself too many times. That causes an error because python is so far deep into
List available cameras OpenCV/Python
I have multiple webcams connected to my PC and I would like to select one camera based on its info (name, resolution etc.). Is there a way to list all the cameras available on a PC, instead of trying all the indices in cv2.VideoCapture()? Answer The answer is negative. OpenCV doesn’t have a method for listing the available video capture
Handle specific exception from python package
I would like to handle the following Exception from py_vollib/py_lets_be_rational in specific way. Tried this without success: what am I doing wrong? any help would be appreciated. Answer Looking at the implementation, you’re missing the period at the end of the sentence: I don’t see the point in this check because that will always be the message the exception is
Data Classes vs typing.NamedTuple primary use cases
Long story short PEP-557 introduced data classes into Python standard library, that basically can fill the same role as collections.namedtuple and typing.NamedTuple. And now I’m wondering how to separate the use cases in which namedtuple is still a better solution. Data classes advantages over NamedTuple Of course, all the credit goes to dataclass if we need: mutable objects inheritance support
Installing numpy with pip on windows 10 for python 3.7
I installed python 3.7 on my Windows 10 laptop since it has been officially released as of today (06/28/2018). Then i tried to install numpy package using pip The install proceeds but finally fails with the below error : Any ideas as to how to overcome this install Error? Thanks. Answer Installing NumPy on Windows is a common problem if
Dataclasses and property decorator
I’ve been reading up on Python 3.7’s dataclass as an alternative to namedtuples (what I typically use when having to group data in a structure). I was wondering if dataclass is compatible with the property decorator to define getter and setter functions for the data elements of the dataclass. If so, is this described somewhere? Or are there examples available?