@chrishamm I got rather frustrated with this process, I can go back and check to let you know if you like. However I realized that DWC handles zip files really well, putting all the files in their appropriate places. Would it be possible to replicate this using the bare bones @resam put in the DuetRRF plugin but uploading a zip file to 0:/sys? It seems easier to troubleshoot uploading a single zip file rather than each file individually!
![](/assets/uploads/system/avatar-default.png?v=1521803371351)
Posts made by roseg0ld
-
RE: Error 403 Uploading System Files
-
RE: Error 403 Uploading System Files
@chrishamm This was all done on RepRapFirmware for Duet 3 Mini 5+ 3.3, so definitely nothing ancient!
-
RE: Error 403 Uploading System Files
@chrishamm @resam Looking back at my logs, it seems to be uploading all of the files, on the last file in the list it seems to complete but then it gets stuck in a loop trying to reupload that final file over and over again before returning:
UM.TaskManagement.HttpRequestManager._onRequestError [374]: request[73c4e4b3][post][PyQt5.QtCore.QUrl('http://10.1.10.64/rr_upload?name=0%3A%2Fmenu%2Fscripts%2FmaterialChangeScripts%2FchangeP')][timeout=None][b'; System f'...] got an error 403, Error transferring http://10.1.10.64/rr_upload?name=0%3A%2Fmenu%2Fscripts%2FmaterialChangeScripts%2FchangeP - server replied: Service Unavailable
-
RE: Error 403 Uploading System Files
@resam I definitely didn't do it from your plugin, I've been ripping apart your source code to try and do this. It's definitely been a 'learn as I go' kind of experience so please forgive any noob errors! Here's what I'm working with:
def updatePrinter(self): self._stage = OutputStage.ready self.writeStarted.emit(self) #receive the zip name zipdata = self._updatePath with zipfile.ZipFile(zipdata, "r") as zip_ref: with tempfile.TemporaryDirectory() as folder: for info in zip_ref.infolist(): self.updProg+=1 self._onConfigUpdateProgress(self.updProg) extracted_path = zip_ref.extract(info.filename, path = folder) path = os.path.normpath(info.filename) pathList = path.split(os.sep) base = pathList[0] filename = pathList[-1] Logger.log('i',"extracting and uploading "+base)#info.filename) with open(extracted_path, 'rb') as fileobj: i+=1 Logger.log("i","uploading item: "+info.filename) self._fileName = info.filename self.configData = fileobj.read() self.onDataReady() Logger.log('d','uploaded file '+str(i)) Logger.log('d','All Done') def onDataReady(self): self._streamer = BytesIO() self._stage = OutputStage.writing self.writeStarted.emit(self) try: self._streamer.write(self.configData) except: Logger.log('e', 'file write failed: ' +str(traceback.format_exc())) Logger.log("d", self._name_id + " | Connecting...") if self._use_rrf_http_api: Logger.log('d','connecting') self._send('rr_connect', query=[("password", self._printer_password), self._timestamp()], next_stage=self.systemUpload, ) else: Logger.log('d','connecting') self._send('machine/status', next_stage=self.systemUpload, ) def systemUpload(self, other): Logger.log("d", self._name_id + " | Uploading... | "+str(self._fileName)) self._streamer.seek(0) self._posterData = QByteArray() self._posterData.append(self._streamer.getvalue()) if self._use_rrf_http_api: self._send('rr_upload', query=[("name", "0:/" + self._fileName)], next_stage = self._sysUploadDone, data=self._posterData, ) else: self._send('machine/file/' + self._fileName, next_stage = self._sysUploadDone, data=self._posterData, method='PUT', ) def _sysUploadDone(self,other): Logger.log('d',"hooray!") self.configData = None
-
RE: Error 403 Uploading System Files
@phaedrux kinda, but I'm unzipping the file in a modified version of the cura plugin and uploading the files one at a time.
-
Error 403 Uploading System Files
I'm trying to build a smart script for updating printers using the DuetRRF Cura Plugin. Basically you read in a zip file that matches the file structure of the SD card and it transfers all of the system files to the appropriate locations and then runs the m997. Everything seems to be working ok, but about 90% of the way through uploading the files, I get an error 403, server replied: Service Unavailable.
Can you tell me what that error means or how I might avoid it?
Thanks in advance!
-
RE: Updating firmware with HTTP Requests
@dc42 for now I'm only confronting the Duet Wifi since all of the printers we've produced use those. Given that, is there reason to avoid uploading firmware, iap, and dwc bins and running m997 s0:1:2 every time the user runs the update script regardless of version number?
-
Updating firmware with HTTP Requests
I'm interested in allowing our users to update their firmware and macros directly from the Nautilus plugin for Cura (I would be happy to submit a pull request with this functionality to the DuetRRF Plugin as well). I started with macros, and everything is working great there using the HTTP request scheme set up by the DuetRRF Plugin. I haven't published the code yet but I will soon.
Before I tackle firmware I wanted to ask @chrishamm, @dc42, and any other knowledgeable folks what to watch out for in terms of firmware installation? For macros I just recursively delete everything in macros and then upload the new ones. I assume firmware updating isn't quite as easy? Is there a good example to look to somewhere as to what order things need to be uploaded/deleted/changed, I didn't find it in the DWC source (I'm not super experienced w/ JS so I'm sure I just missed it).
-
RE: DuetRRF Cura Plugin, add Duet Discovery
@Veti Not explicitly, might there be a way to run that script or something similar without admin privileges? If they're required that would seem to be a significant roadblock to integrating it into a Cura plugin for distribution
EDIT: running as administrator didn't help, script still returns an empty list
-
RE: DuetRRF Cura Plugin, add Duet Discovery
I really appreciate all this assistance, I'm fairly certain I found the missing part @infiniteloop mentioned but I don't know how/why
. I found this stack overflow thread, and Santi Peñate-Vera's script works perfectly for listing IP addresses of the devices on our network on my Mac, but it returns no addresses when run on a Windows machine. Do you know why this script might break down on Windows?
I also need to build functionality for confirming the device is a Duet. Perhaps @chrishamm has a suggestion for the easiest way to confirm a Duet Wifi given an IP address? I could certainly submit any of the DWC http requests and if I get an expected response then it's confirmed, but I think there's a smarter way since my initial zeroconf script returned that properties object with the product as Duet Wifi.
-
RE: DuetRRF Cura Plugin, add Duet Discovery
Sorry, I think I was still a little unclear with my description of the intended use case. Our printer currently has a plugin for Cura that installs all of the printer profiles and also includes a slightly modified version of the Duet RRF Plugin for adding connections and uploading prints. What I would like to do is add a discovery functionality to the plugin (ideally I'll integrate it into the DuetRRF Plugin for everyone else as well) so that a user can open a plugin window in Cura and have it automatically list the Duets on their network for streamlining the connection adding experience.
If a customer of ours (or other Duet user) has 2 or more printers on their local network with the same name, my current script will only return one of them, breaking the discovery functionality. For our purposes, we could follow @bearer's suggestion and give them unique names, though this would add a little more work to our production workflow. This wouldn't be a general solution for adding to the DuetRRF Plugin so it would be nice to find a way to find all of them.
I appreciate everyone's continued input! Based on my now fleshed out description, would it make sense to look to the dhcp server or use nmap? As previously mentioned I'm quite a noob when it comes to networking protocols so most of this is totally new to me.
-
RE: DuetRRF Cura Plugin, add Duet Discovery
Thanks for those ideas and suggestions @bearer and @Veti! Just to be clear, we are producing the Nautilus so all of our printers are going to have the same name coming out of the factory. I'll look at some of your ideas and see if I can get any of them working.
-
RE: DuetRRF Cura Plugin, add Duet Discovery
Okay so I realized it is not firmware specific. All of the printers on our network have the same name, which is why only one seems to appear. When I change the name of a Duet then that one appears as well. Is there a way to access all of the Duets on the network even if they have the same name?
-
RE: DuetRRF Cura Plugin, add Duet Discovery
So as it stands do the Duets need to be on 2.04 to be discovered? Also, is the Zeroconf library searching with DNS-SD by default? Sorry, I'm totally new to working with networking on this level. All the Duets we have are Duet Wifis.
-
DuetRRF Cura Plugin, add Duet Discovery
I'm interested in adding functionality for automated discovery of the Duet to the DuetRRF Cura plugin. I'm aware that zeroconf can do the discovery, but I have basically no experience working with networking. If anyone is interested in working on this project, let me know because I'd love some assistance!
At this point I'm just trying to extract an IP address from a Duet on my local network using Zeroconf. Can anyone give me advice or tell me how to extract an IP address? I run the example script at the bottom of the linked page and this is returned:
Service hydraresearchna._http._tcp.local. added, service info: ServiceInfo(type='_http._tcp.local.', name='hydraresearchna._http._tcp.local.', addresses=[b'\n\x01\nu'], port= 80, weight=0, priority=0, server='hydraresearchna.local.', properties={b'version': b'1.22', b'product': b'DuetWiFi'})
EDIT: I realized that the address is in a readable format in the address object, not addresses. However we have 6 active Duets on our network and it is only returning one. Any idea how to return all of the addresses? Perhaps @chrishamm would know?