@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!
Latest 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