I'm pretty new with CANopen, and also a little bit shooting in the dark...
I would like to know if there are tools or packages in R or Python to convert raw data logged from a CANopen device, to human readable values, with a *.dbc file?
Does someone have experience with this?
In advance thank you for your answers.
Looks like cantools might do the trick:
https://pypi.org/project/cantools/
It can decode CAN data using a DBC file. For actually reading the CAN bus it integrates with python-can.
https://python-can.readthedocs.io/en/master/index.html#
To read CAN data from a log file there's a module in python-can for that
https://python-can.readthedocs.io/en/master/listeners.html
And finally if you want to interact directly with a live CANopen bus there's the CANopen for Python library
https://canopen.readthedocs.io/en/latest/
Related
I am using TimeStats extension on Chrome. And what I want to do now is to read the data in the LocalStorage (which contains all the information about the time I spent on each website) in a Python script and do later data processing.
I know that Ctrl+c and Ctrl+v would work in this case, but I am wondering are there any elegent and reliable ways to do that?
Thanks!
You can use native messaging to send data between your extension and an external app. The sample app for demonstrating native messaging is written in Python, so you have the communications part already solved.
EDIT:
I see now that you are talking about an extension you don't own. Google Chrome currently stores LocalStorage data in SQLite format, so you should be able to read it directly using the sqlite3 package. See the answers to this question.
The file for the timeStats extension would be chrome-extension_ejifodhjoeeenihgfpjijjmpomaphmah_0.localstorage
Note that Google can change the way of storing LocalStorage at any time.
First of all, I agree that this might sound like a question which has already been asked many times in the past. However I couldn't find any answer that was relevant to me in the similar questions so I'll try to be more specific.
I would need to transform PPTX/DOCX files into PDF using Python but I don't have any experience in file format conversion. I have been looking in many places/forums/websites, read a lot of documentation and came across some useful libraries (python-pptx and pyPdf mainly), but I still don't know where to start.
When looking on the Internet, I can see many websites that offer file format conversions as a paying service, even with advanced API's: submit a file via POST and get the transformed PDF file in return. This could work for me, but I am really interested in writing myself the code that does the conversion work from OOXML to PDF.
How would you start doing this? Or is it just impossible on my own?
Thanks for your help!
After some research and with the help of python-pptx's creator, I was able to write to the PowerPoint COM interface using a Virtual Machine.
In case someone reads this thread, this is how I managed to get this done:
- Setup a VM with Microsoft Windows/Office installed on it ;
- Install Python, Django and win32com libraries on the VM.
The files are sent locally from the original Django project to the virtual machine (which are on the same network) through a simple POST request. The file is converted on the VM using win32com.client (which is just a simple call to the win32com.client library) and then sent back as a response to the original Django view, which in turn processes the response.
Note: it took me some time to realize I needed to use the #csrf_exempt decorator for this setup to work.
I am trying to make python grab data from my microphone, as I want to make a random generator which will use noise from it.
So basically I don't want to record the sounds, but rather read it in as a datafile, but realtime.
I know that Labview can do this, but I dislike that framework and am trying to get better at python.
Any help/tips?
You may be interested by PyAudio. I think you can get some bytes from the stream.
Here is an interesting example
u can refer speech_recognition module or PyAudio module for recording speech.I used PyAudio module with Microsoft cognitive service.It worked fine for me.
I'm building a web application which will include functionality that takes MS Word (and possibly input from a web-based rich text editor) documents, substitutes values into the formfield placeholders in those documents, and generates a PCL document as output.
I'm developing in python and django on windows, but this whole solution will need to be deployed to a web host (yet to be chosen), which in practice means that the solution will need to run on linux.
I'm open to linux-only solutions if that's the only way. I'm open to solutions that involve talking to a server written in another language. I am able to write C++ or java if necessary to get this done. The final output does have to be in PCL format.
My question is: what is a good tool chain for generating PCL from word documents using python?
I am considering using some kind of interface to openoffice to open the word documents, do the substitutions, and send the output to some kind of printer driver. Does anyone have experience with this? What libraries would you recommend?
Options for interfacing that I have identified include the following; any other suggestions would be greatly welcomed:
Ulif.openoffice: http://pypi.python.org/pypi/ulif.openoffice/0.4
Py3o.renderserver: https://bitbucket.org/faide/py3o.renderserver
OpenOffice-python: http://openoffice-python.origo.ethz.ch/
A second approach would be to use something like paradocx ( https://bitbucket.org/yougov/paradocx/wiki/Home ) to open the word files, do the substitutions using that in python, then somehow interface with something that can output PCL. Again, any experience or comments on this approach would be appreciated.
I will very much appreciate any comments on tools and toolchains, and ideas or recipes that you may have.
This question covers similar ground to, but is not the same as: How to Create PCL file from MS word
Ghostscript can read PS (Postscript) or PDF and create PCL. You can use python libraries or just subprocess....
OK, so my final solution involved creating a java webservice to perform my transcoding.
Docx4j provides a class org.docx4j.convert.out.pdf.viaXSLFO.Conversion which hooks into apache FOP to convert Docx to PDF; that can be easily hacked to convert to PCL (because FOP outputs PCL)
Spark is a lightweight java web framework which allowed me to wrap my transcoder in a web service
Because I also manipulate the document, I need to have some metadata, so the perfect thing is a multipart form. I decode that using Apache Fileupload
In almost all cases, I had to upgrade to the development versions of libraries to get this to work.
On the python side I use:
requests to communicate with the web service
poster to prepare the multi-part request
I'd like to extract the info string from an internet radio streamed over HTTP. By info string I mean the short note about the currently played song, band name etc.
Preferably I'd like to do it in python. So far I've tried opening a socket but from there I got a bunch of binary data that I could not parse...
thanks for any hints
Sounds like you might need some stepping stone projects before you're ready for this. There's no reason to use a low-level socket library for HTTP. There are great tools both command line utilities and python standard library modules like urlopen2 that can handle the low level TCP and HTTP specifics for you.
Do you know the URL where you data resides? Have you tried something simple on the command line like using cURL to grab the raw HTML and then some basic tools like grep to hunt down the info you need? I assume here the metadata is actually available as HTML as opposed to being in a binary format read directly by the radio streamer (which presumably is in flash perhaps?).
Hard to give you any specifics because your question doesn't include any technical details about your data source.