chemicstry / candle_driver Goto Github PK
View Code? Open in Web Editor NEWPython wrapper for candle (gs_usb) adapters.
License: MIT License
Python wrapper for candle (gs_usb) adapters.
License: MIT License
Here is my screenshot of my cangaroo:
So it received a packet from my device.
And my setup:
But following python3.8 code doesn't work though:
import candle_driver
devices = candle_driver.list_devices()
print('Found {} candle devices.'.format(len(devices)))
device = devices[0]
print('Device path: {}'.format(device.path()))
print('Device name: {}'.format(device.name()))
print('Device channels: {}'.format(device.channel_count()))
device.open()
ch = device.channel(0)
ch.set_bitrate(1000000)
ch.start()
ch.write(0x141, bytes([0x92, 0, 0, 0, 0, 0, 0, 0]))
try:
frame_type, can_id, can_data, extended, ts = ch.read(1000)
print('Received {} from ID {} at {}'.format(can_data, can_id, ts))
except TimeoutError:
print('CAN read timeout')
# close everything
ch.stop()
device.close()
Its result:
Found 1 candle devices.
Device path: \\?\usb#vid_1d50&pid_606f&mi_00#6&2d528fd&0&0000#{c15b4308-04d3-11e6-b3ea-6057189e6443}
Device name: candle_2d528fd
Device channels: 1
test_candle.py:15: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
ch.write(0x141, bytes([0x92, 0, 0, 0, 0, 0, 0, 0]))
CAN read timeout
Please help!
I am using CANable Pro after updating its firmware to candle_2d528fd
Thanks!
Doing a pip install candle_driver
fails in a Conda environment with Python 3.10 in Windows:
Collecting candle_driver
Using cached candle_driver-0.1.5.tar.gz (13 kB)
Building wheels for collected packages: candle-driver
Building wheel for candle-driver (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\user\Anaconda3\envs\project_env\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-mubj47fl\\candle-driver_92913d5af7654aaaaee144286eff6d28\\setup.py'"'"'; __file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-mubj47fl\\candle-driver_92913d5af7654aaaaee144286eff6d28\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\user\AppData\Local\Temp\pip-wheel-r5xlfk2t'
cwd: C:\Users\user\AppData\Local\Temp\pip-install-mubj47fl\candle-driver_92913d5af7654aaaaee144286eff6d28\
Complete output (15 lines):
C:\Users\user\Anaconda3\envs\project_env\lib\site-packages\setuptools\dist.py:757: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
warnings.warn(
running bdist_wheel
running build
running build_ext
building 'candle_driver' extension
creating build
creating build\temp.win-amd64-3.10
creating build\temp.win-amd64-3.10\Release
creating build\temp.win-amd64-3.10\Release\src
creating build\temp.win-amd64-3.10\Release\src\candle_api
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -Icandle_api -IC:\Users\user\Anaconda3\envs\project_env\include -IC:\Users\user\Anaconda3\envs\project_env\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\cppwinrt" /Tcsrc/candle_api/candle.c /Fobuild\temp.win-amd64-3.10\Release\src/candle_api/candle.obj
candle.c
src/candle_api/candle.c(22): fatal error C1083: Cannot open include file: 'candle.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.32.31326\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Failed building wheel for candle-driver
Running setup.py clean for candle-driver
Failed to build candle-driver
Installing collected packages: candle-driver
Running setup.py install for candle-driver ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\user\Anaconda3\envs\project_env\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-mubj47fl\\candle-driver_92913d5af7654aaaaee144286eff6d28\\setup.py'"'"'; __file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-mubj47fl\\candle-driver_92913d5af7654aaaaee144286eff6d28\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\user\AppData\Local\Temp\pip-record-vz71gnre\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\user\Anaconda3\envs\project_env\Include\candle-driver'
cwd: C:\Users\user\AppData\Local\Temp\pip-install-mubj47fl\candle-driver_92913d5af7654aaaaee144286eff6d28\
Complete output (17 lines):
C:\Users\user\Anaconda3\envs\project_env\lib\site-packages\setuptools\dist.py:757: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
warnings.warn(
running install
C:\Users\user\Anaconda3\envs\project_env\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_ext
building 'candle_driver' extension
creating build
creating build\temp.win-amd64-3.10
creating build\temp.win-amd64-3.10\Release
creating build\temp.win-amd64-3.10\Release\src
creating build\temp.win-amd64-3.10\Release\src\candle_api
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -Icandle_api -IC:\Users\user\Anaconda3\envs\project_env\include -IC:\Users\user\Anaconda3\envs\project_env\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.32.31326\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\cppwinrt" /Tcsrc/candle_api/candle.c /Fobuild\temp.win-amd64-3.10\Release\src/candle_api/candle.obj
candle.c
src/candle_api/candle.c(22): fatal error C1083: Cannot open include file: 'candle.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.32.31326\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\user\Anaconda3\envs\project_env\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-mubj47fl\\candle-driver_92913d5af7654aaaaee144286eff6d28\\setup.py'"'"'; __file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-mubj47fl\\candle-driver_92913d5af7654aaaaee144286eff6d28\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\user\AppData\Local\Temp\pip-record-vz71gnre\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\user\Anaconda3\envs\project_env\Include\candle-driver' Check the logs for full command output
```.
Here is a log when I executed the testing script with python3.8:
test.py:17: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
ch.write(10, b'abcdefgh')
test.py:20: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
frame_type, can_id, can_data, extended, ts = ch.read(1000)
I think this can fix this issue? mongodb/winkerberos#38
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.