duet3d / dsf-python Goto Github PK
View Code? Open in Web Editor NEWDuetSoftwareFramework Python Bindings
License: GNU Lesser General Public License v3.0
DuetSoftwareFramework Python Bindings
License: GNU Lesser General Public License v3.0
Having an available easy to install and update package allows user to use this functionality quicker and might make it more popular.
A pip package should also allow very easy integration into Arch Linux and probably also Debian Linux.
Im working on a plugin, which requires long live connection, and experience a lot of natural disconnections:
Plugin works on SBC
Main system may and will be reset without reset/reboot SBC
It'll be good if we have some tools to check the connection status,
like is_connected method
Have somethihng like
class BaseConnection:
def is_connected()->bool:
return connection->current_status
At the moment I workaround it with try except, but it mess the code
Another possible workaround - is open/close connection per every command/request, which may be resource consuming operation
Ex. Photos, mockups, etc.
test doesn't seem to work right. Fix it? Delete it?
dsf-python/src/dsf/connections.py
Line 460 in 8585a90
now causes this example to be broken:
dsf-python/examples/custom_m_codes.py
Line 34 in 8585a90
RepReap 3.4
3.2.2
Cannot
Config.g
No response
No response
I tried two approaches here. The first is with a windows PC. Realizing the issue that socket library in "base_connection.py" used the AF_UNIX tag I simply replaced that with AF_INET. However the issue comes down to the actually socket connect call (socket.connect()). In the source code it searches for a dcs.sock file located in the directory "/var/run/ ... etc". Which since a windows machine it cannot be found so I bypassed this by inputting in my own tuple of the IP address I assigned to the board with the firmware flash and port 22. I chose port 22 due to some obscure documentation about connecting to the board via Putty (https://docs.duet3d.com/User_manual/Machine_configuration/SBC_setup). I however I received this error:
Assuming that this is some Windows and Linux mismatch, I used pip to download the dsf-python library onto a SBC (Raspi 4b) to try and run it. After trying to run a simple connection call the code raised an error of the dcs.sock file not able to be found. I then uninstalled the package and cloned the repo itself and ran the "python setup.py install" and proceeded to try to run my script again. Once again no successful socket connection, I am unsure of what to proceed to next as I cannot find this file required to run this. This may go against policy but is there potentially a way I can get either the dcs.sock file or the port number that allows me to communicate to the Duet?
Thank you for your time and I know this is long winded but I appreciate the time taken to address this.
Expected result
Successful Socket connection
Observed result
No successful connection
Steps to reproduce
PIP installation on SBC (RPi 4b)
Instantiate a CommandConnection Object, follow that by trying to connect to the Duet.
Clone Repo on SBC (RPi 4b)
Command line: "python setup.py install". Attempt to use the same socket connection and the device just refuses to connect
Windows PC
Clone the main repository. In the "base_connection.py" file change the socket connection to AF_INET instead of AF_UNIX. Pass in the IP address and port 22 into the socket.connect() method.
@mfs12 looks like 15accc1 introduced a major bug with a wrong socket filename. The python API is currently not working at all because it can't find the DCS socket file.
The correct path is (and was) /run/dsf/dcs.sock
-- see https://github.com/Duet3D/DuetSoftwareFramework/blob/v3.3-dev/src/DuetAPI/Connection/Defaults.cs#L26
Not dsf.sock
.
To improve programming experience the error handling should use native language features. In python this are exceptions.
Clarification is needed here for go language as well.
As many errors can be thrown and should shown as easy and clear as possible to the programmer/user most errors should be mapped to exceptions. Here is more specification needed.
Right now the state of tests is unclear. From my perspective they are not working properly. So far i can confirm simple commands are working. But intercept and subscribe commands do not provide any working tests at the moment.
Implement basic testing for
Ideally those tests can be run with a remote SBC, on a SBC or against mockup SBC.
If run with an SBC SBC configurations need to be provided as well.
when importing top level module only some constants are imported and none of the submodules.
To make it more handy import everything at once.
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.