Local Variable Referenced Before Assignment Xbmc For Mac


2014-12-17, 00:55 (This post was last modified: 2015-10-18, 03:49 by corona.)

Large parts of this addon are currently broken due to changes in the netflix website. Some people are able to use it, many aren't.
Very limited assistance is available if you're having problems, people are investigating possible solutions.

This is a continuation on from the original thread: http://forum.kodi.tv/showthread.php?tid=178693
A number of users have started contributing to my fork of the plugin as AddonScriptorDE's original version broke due to site changes. This fork is installed from my repo rather than asde's one, please see the bottom of this post for links.

This is an add-on for browsing Netflix content via XBMC. Video playback is done via the new Netflix HTML5 User Interface.

NetfliXBMC works under Windows, OSX and Linux. IMPORTANT: Chrome 37+ is required for NetfliXBMC 1.3.0+! Under Win 8.1 it's also possible to use IExplorer.
Other browsers (currently) don't support HTML5 DRM. Linux users may also need to update libnss (not required for Ubuntu 14.04+).

This Will Not work on anything else. So no it wont work on android, apple tv, roku, amazon stick, raspberry pi. It will not work, and most likely will never work.
Basically if netflix can't be run in the standard chrome browser, then it can't work.

Chromebook is the only maybe on the list as netflix does work in chrome. However I don't know how to launch chrome from a different app with a specified url on chrome os, and don't have a chromebook to try.

This plugin does not need silverlight/pipelight to run, just the stable version of chrome.

Anything related to Chrome should be discussed in the Chrome Launcher thread!

@esoteradactyl recommends using Launcher4Kodi to run Kodi on windows. http://forum.kodi.tv/showthread.php?tid=136798
To ensure the browser maintains focus when watching video: open the launcher gui, choose the external player tab and add the path to your browser of choice. Make sure "focus external player" is checked and you should be good to go. (http://forum.kodi.tv/showthread.php?tid=...pid2106824)

There is an unsupported Control Utility for better usability. It hides the mouse cursor and lets you control playback via keyboard/remote.
Default Netflix Player controls and useful commands like closing the browser can be mapped to any key (via addon settings).[/size]
The cursor can also be controlled via keyboard/remote. Default keys.

I recommend this configuration when using Windows with a MCE compatible remote:
- Browser: Chrome (IE is not supporting "Enter" / "OK" on MCEremote)
- Default keys: Seeking via left/right. Play/pause via OK.
- To stop playback, map it to the "Back" key with help of the Control Utility
Running fine for me...

If you have cliclick installed, the mouse gets hidden automatically.
Close the browser via CMD+Q or map it to any remote key via an external tool.

If you have xdotool installed, the mouse gets hidden automatically.
Close the browser via ALT+F4 or map it to any remote key via an external tool.

General Netflix playback controls:
Seek: Left/Right
Play/Pause: Space/Enter

Webremote (Yatse etc.):
The webremote stuff must be activated via the addon settings. Under linux, you need to have xdotool installed. Under OSX, you'll need cliclick.
Currently, the controls are not mappable. Here is a list of all current implemented controls...
For me, only some action IDs worked to close the browser. You can view all available actions IDs here. You can also try some other IDs yourself manually.

Add to library function:
You can add movies and tvshows (full shows & single seasons) to your library via context menu.
Add this source to your library: "Home folder"->userdata->addon_data->plugin.video.netflixbmc->library->Movies/TV

The addon supports Netflix profiles. If you only have one profile configured on netflix you should activate the appropriate setting.
Video listing and playback start is faster with Single-User accounts. Hint: Remove the automatically created KIDS profile if you don't need it...

It's not possible to request new api keys at the moment, so the addon needs to use the Netflix website.
I added requesting extra information. Of course it's a bit slower, but it's cached. This is also needed for some features.
Covers & fanart images can (optional) be received from themoviedb. The images are loaded in the background.

- If you start playback via the XBMC database, you may (sometimes) see a xbmc message on video playback, even though everything works fine.
- Having problems? Getting a script error: Upload your debug log. Any other problem: Give me as much info as possible: What exactly is not working? What have you tried so far? What OS?

- Your repo is empty. What to do?
- XBMCbuntu: Chrome does not start in fullscreen. What to do?
- Windows: Some mapped keys are not always working... Why?
- Does this addon work under RPi / OpenElec / iOS / Android? In short: No.

Context menu entries:
- Continue watching / Show seasons (TV-Shows)
- Play trailer
- Add to / Remove from my list
- Similar Movies / TV Shows
- Add to library
- Switch profile (Main-menu)

Settings (General):
- eMail
- Password
- Single-User account (faster)
- Show profile selection on each start
- Get covers & fanart images from themoviedb
- Update library after adding media
- Browse tv shows instead of autoplaying

Settings (Views):
- Force View
- ViewID (Videos)
- ViewID (Episodes)
- ViewID (Viewing Activity)

Settings (Advanced):
- Library path (source)
- Use Control Utility (Windows)
- Configure Control Utility
- Enable webremote control
- Chrome: Don't use kiosk mode
- Delete cache
- Delete cookies
- Reset NetfliXBMC!

Install my repo zip to get going from here: http://www.alelec.net/kodi/repository.alelec.zip
All development is happening out of my github: https://github.com/andrewleech/plugin.video.netflixbmc

alelec kodi repo, hosting my binary addons not eligible for the official repo .
netflix, sbs ondemand, webdriver etc.


This is because, even though exists, you're also using an assignment statement on the name inside of the function ( at the bottom line). Naturally, this creates a variable inside the function's scope called (truthfully, a or will only update (reassign) an existing variable, but for reasons unknown (likely consistency in this context), Python treats it as an assignment). The Python interpreter sees this at module load time and decides (correctly so) that the global scope's should not be used inside the local scope, which leads to a problem when you try to reference the variable before it is locally assigned.

Using global variables, outside of necessity, is usually frowned upon by Python developers, because it leads to confusing and problematic code. However, if you'd like to use them to accomplish what your code is implying, you can simply add:

inside the top of your function. This will tell Python that you don't intend to define a or variable inside the function's local scope. The Python interpreter sees this at module load time and decides (correctly so) to look up any references to the aforementioned variables in the global scope.

Some Resources

  • the Python website has a great explanation for this common issue.
  • Python 3 offers a related statement - check that out as well.

0 Replies to “Local Variable Referenced Before Assignment Xbmc For Mac”

Lascia un Commento

L'indirizzo email non verrà pubblicato. I campi obbligatori sono contrassegnati *