Kodi Community Forum

Full Version: Frodo and Amazon Instance (Bluecop) addon - mechanize and demjson modules
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am testing the Frodo Beta 1 install and when I try to run the Amazon Instant plugin from bluecop I get two script errors. The issue is related to two missing modules; mechanize and demjson. The errors are like the following related to the mechanize. I commented out that line and then later received a similar error for the demjson. How can I add these modules into my Frodo install?

10:01:37 T:4896 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.ImportError'>
Error Contents: No module named mechanize
Traceback (most recent call last):
File "MYPATH\XBMC\addons\plugin.video.amazon\default.py", line 12, in <module>
import resources.lib.common as common
File "MYPATH\XBMC\addons\plugin.video.amazon\resources\lib\common.py", line 6, in <module>
import mechanize
ImportError: No module named mechanize
-->End of Python script error report<--
I was having the same problem in RC 1 and 2. I fixed it by downloading the demjson.py file from http://deron.meranda.us/python/demjson/ to the Amazon plugin library: C:\Users\YOUUSERNAME\AppData\Roaming\XBMC\addons\plugin.video.amazon\resources\lib (for windows 7). Hoep this helps.
I was having a similar issue with Frodo RC2, here's my fix:

I followed ntan's instructions and added demjson from http://deron.meranda.us/python/demjson/ to \resources\lib\.

After that, I installed mechanize-0.2.5.zip. To install mechanize, download the zip from http://pypi.python.org/pypi/mechanize/, and copy the 'mechanize' subfolder to C:\Program Files (x86)\XBMC\system\python\Lib\site-packages. This seems inelegant, so if anyone knows a cleaner way to install mechanize please let me know.

The script loaded fine; However, it failed to log onto Amazon. It seems that the regex for Amazon's CustomerID is out of date.

Replace the following in lines 138 and 149 of \resources\lib\common.py:
customerId = re.compile('"customerId" : "(.*?)",').findall(data)[0]
with:
customerId = re.compile('"customerID" ?: ?"(.*?)"').findall(data)[0]

hmm both demjson and mechanize are modules on my repo. The are listed as dependencies so should be installed when installing the add-on.

I am not sure what would be causing this but I will try to replicated it.
Hmm... When downloading from your repository, Hulu worked but Amazon was stuck at "downloading 0%"; I tried downloading several times. I then installed by zip, so perhaps I should have installed the dependencies manually. Any idea why the plugin did not download automatically in the first place?