Is it possible to use socketCAN protocol on MacOS - python

I am looking to connect to a car wirelessly using socketCAN protocol on MacOS using the module python-can on python3. I don't know how to install the socketCAN protocol on MacOS. Pls help.

This cat managed to get it basically working:
socketcanx
I have compiled it on my hackintosh (running Mojave) and it works from the terminal. I have not played around with it more than that, as it was just easier to use Liunx in a VM or docker or one of my Linux machines. When compiled, I was able to use all of my makeshift CAN devices and a USB2CAN device without issue. I am sure with some work, it can be used with Python-CAN, though you would need to write your own interface module for Python-CAN. As far as I can tell, it should work more or less the same, though the code is old (4 years since last update).
As stated in the accepted answer, you can use a native CAN device that is compatible with macOS and as long as it's compatible with Python-CAN, then you are good to go (or if it works on mac and not compatible, you can create and interface for the device and submit a pull-request on github for Python-CAN).

SocketCAN is implemented only for the Linux kernel. So it is not available on other operating systems. But as long as your CAN adapter is supported by python-can, you don't need SocketCAN.

Related

Using PyParallel in Windows XP

I have successfully implemented the PyParallel module in both Linux and Mac OSX as part of a large application to interface with a sensor I am developing.... I am now attempting to use this application on an instance of Windows XP. I have found several references (including right from the PySerial/PyParallel group) that:
The windows version needs a compiled extension and the giveio.sys driver for Windows NT/2k/XP. It uses ctypes to access functions in a prebuilt DLL.
However, I don't know what "a compiled extension" requirement is. And, I can't seem to get givio.sys to work. I obtained giveio.sys here and followed the recommendations, but LoadDrv.exe fails to "start" the service (it does "install", however).
I cannot find specific examples online of getting PyParallel working on Windows XP. Since PyParallel is "thoroughly" integrated into the application and is working on both Linux and Mac OSX, I'd prefer not to use a different module -- especially since PyParallel is great to not require root/administrator privileges to utilize.
I was having trouble with giveio.sys and LoadDrv.exe as well.
There is a handy installer that does it all automatically:
http://sourceforge.net/projects/pyserial/files/pyparallel/giveio/

How to control Enttec Open DMX USB via Python?

I'm wondering is that possible to control lights connected to Enttec Open DMX USB via Python shell. If it is, how to?
The Open Lighting Project (formerly known as opendmx) provides a Python API, as part of their Open Lighting Architecture (OLA), for use the OpenDMX USB on OSX and Linux. If you're on Windows then I've not found anything apart from the code from Enttec's website which uses the FTD2XX.DLL libraries.
However it should be noted that one cannot use normal serial based libraries (pyserial etc). Basically OLA either needs to use a special kernel module on Linux, or use the generic FTDI non-serial kernel driver in combination with libftdi on Mac or Linux - for details see their device specific page. There is now pre-built support for Raspberry Pi's on the OLA website.
The communication and protocols used are completely different from Enttec Pro range (which one can just control using simple serial commands with something like pyserial, though OLA also talks to them too).
I know this is quite an old post, however DmxPy has worked very well for me the last few months. It only works for Python 2 but I know there's some Python 3 ports out there.
It's stupid simple to use. I personally use it in my companies quality control software. While it only work for DMX (not RDM) I think it's much easier to use than OLA's Python Wrapper. It works flawlessly with our ENTTEC as well!
UPDATE: Here's my Python 3 port: https://github.com/trevordavies095/DmxPy
I had the exact same problem, so I wrote a simple python programm for all those that are running windows; have a look: https://github.com/Coronon/PyOpenDmxUsb
It uses a C# Server (Because their C# interface was the only one that worked for me) and a Python Client and is super easy to use.
It is compatible with the non pro version too. (The Pro Version is way easier to use and I would use the AcceptedAnswer instead [But the normal one isnt supported])
Edit: This may be 'advertisement' but my project is Open-Source and super easy to use, so I believe this can be useful to others :)

libusb 1.0 installation, for XP, for noob

I seem to be a fairly reasonable programmer once the configuration is set up, but am a noob at yak shaving, especially when there is a confusing choice of different yaks.
I am enjoying learning Python. It was the obvious choice with its abundance of libraries, native execution on both windows (for the moment) and linux (later, but not right now), and regular syntax. Up to now, everything I've wanted to add on has either just installed from a binary, or just been a simple file copy to the lib folder; pyaudio, numpy, videocapture, etc etc.
I am now tackling USB. I have bought a UM245R usb module and want to bit-bang it. I quickly learnt from PyUSB errors that I needed a backend. After a bit of reading, it appeared that as I have no legacy code, libusb1.0 was the appropriate choice. Is this correct?
Now my problems start. I am thoroughly confused about how to get it onto my PC. I have no tools or experience to build it from source, and cannot find anything that claims to be a self-installing .exe. I have seen a number of seperate installers mentioned, but cannot find any concensus on which uses what or is the correct way to go. I think I've been through all the replies here tagging libusb, without finding the specifics.
Would somebody who's done this for windows (XP SP3) take me by the hand and tell me what to use to install it please, for Python 2.6.
thanks in advance
From the pyUSB tutorial; "platform neutrality; ... PyUSB comes with builtin backends for libusb 0.1, libusb 1.0 and OpenUSB". So pyUSB doesn't really care what you use. But libusb 1 seems to be the safe choice.
Look at the windows backend section of the libusb wiki. You'll find prebuilt windows binaries (zadig.exe, under "Driver Installation") for libusb 1.0 there.
There are known restrictions to the underlying Microsoft driver that might impact its usability; e.g. you cannot reset USB devices nor change the device configuration.

How I can retrieve webcam info in python?

I need to retrieve the number of webcams instaled in my system and the brand, manufacturer, device id, etc., of the webcam.
Is there any way to do that in Python, and independent of the operating system?
There's no truly cross-platform solution, but on Linux you can use os.popen('lsusb') (or something along those lines) and then just scrape the screen (using grep or something else). For finding out on Windows, you can try using a TWAIN binding for Python (it's the Windows webcam protocol, a Python binding exists here, but it's not actively maintained). VideoCapture might have what you need.
I found a partial solution, which is to use the command:
v4l2-ctl --list-devices
But only works on Linux, but on Windows I have no way of detecting the amount and the name of the installed webcams.

How to access a MS SQL Server using Python 3?

I'm using a linux machine to make a little python program that needs to input its result in a SQL Server 2000 DB.
I'm new to python so I'm struggling quite a bit to find what's the best solution to connect to the DB using python 3, since most of the libs I looked only work in python 2.
As an added bonus question, the finished version of this will be compiled to a windows program using py2exe. Is there anything I should be aware of, any changes to make?
Thanks
One option would be trying the pyodbc branch for python 3 support. I think some people have reported success, but you might want to inquire at the pyodbc discussion group.
If you stick to platform independent parts of the python library (most of it), you shouldn't have any issues on windows with py2exe.
I can't answer your question directly, but given that many popular Python packages and frameworks are not yet fully supported on Python 3, you might consider just using Python 2.x. Unless there are features you absolutely cannot live without in Python 3, of course.
And it isn't clear from your post if you plan to deploy to Windows only, or Windows and Linux. If it's only Windows, then you should probably just develop on Windows to start with: the native MSSQL drivers are included in most recent versions so you don't have anything extra to install, and it gives you more options, such as adodbapi.
If you want to have portable mssql server library, you can try the module from www.pytds.com. It works with 2.5+ AND 3.1, have a good stored procedure support. It's api is more "functional", and has some good features you won't find anywhere else.

Categories