I am trying to connect a Flir AX8 camera through python. This camera is connected to the ethernet port of the laptop. So, the VideoCapture() isn’t recognising the port, I’ve tried all indexes for it (0, 1, 2), but it doesn’t connect. Can anyone help me that how can i connect the camera to py…
Python spectrogram in 3D (like matlab’s spectrogram function)
My question is the following: I have all the values that I need for a spectrogram (scipy.fftpack.fft). I would like to create a 3D spectrogram in python. In MATLAB this is a very simple task, while in python it seems much more complicated. I tried mayavi, 3D plotting matplotlib but I have not managed to do th…
Round a floating point number to n digits ignoring leading zeros and preserving them
Floating Point = 11.0000123456789 I want to round the above floating point number to 11.00001235. So I want the base portion of the float rounded to 4 digits while ignoring and preserving the leading zeros and adding back in the significand at the end. I have the following, it is short and sweet but feels a l…
Python in VSCode: Set working directory to python file’s path everytime
So I want to migrate from Spyder to VSCode, and I come across this problem where I cannot access a dataset as my working directory is not the same as the dataset’s path. launch.json is not auto-generated for me as I’m not debugging anything (I tried this). How do I set the working directory to alw…
Update DataTable on Tap event in Bokeh
I am trying to calculate euclidean distance of two points. Initial distance is calculated in the data. Then, when the user is moving the line, I’d like the distance column to update based on the new coordinates. I can see that x and y columns are updating, but not the distance column. Below is my attemp…
PyOpenGL raises an exception after being frozen using cx_Freeze?
I am making a game in PyOpenGL and want to freeze it using cx_Freeze. But it seems to me that importing PyOpenGL raises an exception in the PyOpenGL module. When I run the frozen script: How can I solve this issue and get PyOpenGL to work? EDIT: For people who don’t have PyOpenGL, the below function sho…
Why do I get a warning when concatenating lists of mixed types in Pycharm?
In Pycharm, the following code produces a warning: Why? Should I not be concatenating two lists of mixed, hinted types? Answer As requested in the comments, here are some reasons why type checkers don’t allow this. The first reason is somewhat prosaic: the type signature of list.__add__ simply doesnR…
How to expand / dilate a numpy array?
I’m performing a image analysis and generated seeds in the form of a boolean array : As I want to do a subsequent analysis on the area surrounding the True value, I want to expand it (by a certain number, say pixels). This would result in the following: Is there any function or simple way of solving my …
Pyttsx isn’t showing installed languages on windows 10
I am trying to use pyttsx3 to say French text. However, only English is available. Following the advice of How to change the voice in pyttsx3?, I tried to install the French speech pack as explained here https://support.office.com/en-us/article/how-to-download-text-to-speech-languages-for-windows-10-d5a6b612-…
sqlalchemy foreign key could not find table
I’m making a database using sqlalchemy which consists of three classes, User, Meeting, MeetingRoom I want to create a foreign key in Meeting for the Meeting room, but for some reason it gives the following error sqlalchemy.exc.NoReferencedTableError: Foreign key associated with column ‘meeting.mrid̵…