Downloading a File

Don't mind the mess!

We're currently in the process of migrating the Panda3D Manual to a new service. This is a temporary layout in the meantime.

To download a file while the game is running without blocking the connections one has to use HTTPClient and HTTPChannel objects. This will allow the file to be downloaded in the background using the downloadTask task.

self.http = HTTPClient() = self.http.makeChannel(True)'http://my.url/'))
self.rf = Ramfile()
taskMgr.add(self.downloadTask, 'download')
def downloadTask(self, task):
        # Still waiting for file to finish downloading.
        return task.cont
    if not
        print "Error downloading file."
        return task.done
    data = self.rf.getData()
    print "got data:"
    print data
    return task.done

You can also download to file


The file channel can be quarried for further information while the game is running to get the current download state.

mbDownloaded =
percentDownloaded = 100.*
Previous Top Next