Let me first preface this question by stating that I really don't know a whole
lot of Python: in fact, all I know of the language I learned from playing
around with IMDbPY. Therefore, you'll have to dumb your responses down a bit
*sheepish smile*
Ok, into the meat of the question:
I'm attempting to create a script that lets you find the "connections" between
two actors (i.e. through movies and actors they have worked with, how are they
connected, 6 Degrees of Kevin Bacon?). Retrieving the information is easy
enough, but the logic that looks for the connections is slightly more
complicated than I can handle in Python, so, being a Java programmer, I decided
to use Jython. Here's where I run in to some issues, and I'm fairly confused to
say the least.
1. I can correctly import the imdb package into my program (I'm using the
Python Interpreter method of Jython if you're at all familiar with it. It goes
something like this, fairly simple to understand.)
PythonInterpreter pi = new PythonInterpreter();
pi.exec("import imdb");
pi.exec("i = imdb.IMDb(accessSystem=\'mobile\')");
Basically, you just feed the Python commands to the PythonInterpreter object as
strings.
2. I'm using the mobile access system. Part of this is for speed, part of it is
lxml issues, more on this in a bit.
3. Using search_person, I can successfully retrieve a Person (i.e.
pi.exec("bacon = i.search_person(\"Kevin Bacon\")[0]");
4. calling .keys() on this Person gives you what you would expect by default
Here's where things get interesting:
5a. When I call i.update(bacon) in the interactive python shell, the 'actor'
info set is now listed as an info set of bacon
5b. When I call pi.exec("i.update(bacon)"); inside my Jython script, about 1/4
of the info sets that should be returned do not show up when you call .keys(),
'actor' being one of them.
6b. Using http instead of mobile in my Jython script gets me some of the info
sets, but still not 'actor'.
7b. Even though I import sys and append the path to lxml to path, the script
always falls back to beautifulsoup, and it takes forever. This doesn't happen
in the interactive shell.
So, now that the background is out of the way, does anyone know why I'm getting
different results in the shell and the script? Better yet, does anyone know how
to fix it? If someone can help me fix the lxml thing, that would be helpful,
but it's not a primary concern.
Thanks in advance,
Nick Cafarchio
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Imdbpy-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/imdbpy-help