Naturally, after claiming I could upload images embedded in a post using blogtool, I tried to use it this morning to publish the post with the pictures of the yard and it puked. One of the errors was minor and easily fixable. The bigger problem was a cryptic message related to the XMLRPC API function metaWeblog.newMediaObject. The error message read “junk in document element:…”
I’d run into this earlier and that problem was related to the maxiumum file upload size not being high enough. I changed the limit using the php.ini file and everything seemed to be OK. I figured that problem out because I couldn’t upload the file even using the uploader that comes with the WordPress software. This time around, I was able to upload the file using the WordPress software- but not using XMLRPC.
My breakthrough came when I found out that it’s possible to get a plethora of debugging info from the XMLRPC library by setting “verbose=True” when creating a proxy server. Now I can’t say this with certainty, but it appears that however the library parses responses from the server does not account for the error I was getting (It’s possible that the extra set of ‘<>‘ around the memory numbers was confusing the parser, but lacking any expertise or intimate knowledge of how it works, I certainly can’t state this with any certainty. It’s entirely possible that it’s working as expected). Thus, the error message “junk in document” was misleading. The actual error was related to memory limits at the server, meaning the problem was at the server and not with my client. In this case, the class-IXR.php script was the culprit.
More poking around revealed that the place to start was the php.ini file. I increased the “memory_limit” setting by what seemed like an appropriate amount and then updated the php.ini files on the site.
VOILA!
Uploads working.
Of course, stuff like this also makes me realize how far I have to go before this program could really be considered well crafted. It’s functional, but there are lots of issues related to error reporting and dealing with errors in general. I’ll have to look into that aspect of python a lot more closely. In fact, I’ll probably also have to start looking into it sooner than later so that the task of implementing better error processing doesn’t become to difficult. Also, I wonder if there is anyway my client could determine if this error might occur?