On Thu, Nov 17, 2011 at 07:10, Nicholas Cafarchio <cafni...@pct.edu> wrote:
>
> 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.

Right, 'cause the task was not already difficult enough,
so better put jython into the equation!  Makes sense... :P


> 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.

lxml is (partially) a C python module.  I don't remember how Jython works
with these.

> 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.

My only idea is crazy and already disproved by a fast test I made:
while I did swear some time ago that the keys used by the
Movie/Person/... classes
to store information are strings (besided the few cases where they are instances
of other objects), the truth is that many times they are unicode.
Not that it could (should?) create any problem, but I noticed that for 'mobile'
some are strings and some are unicode (u'actor' is unicode)
The same is true for 'http', but in that case 'actor' is a string... :-/

Another absolutely crazy option: is it possible that in the environments
you're using (jython and the "normal" python), there's a proxy used in one
an not in the other?  (i.get_proxy() should tell you).

And, by the way, how does Jython and its PythonInterpreter share
memory, if they do?  "i" is a very common variable name... ;-)

Ok, I'm officially out of ideas. :D

-- 
Davide Alberani <davide.alber...@gmail.com>  [PGP KeyID: 0x465BFD47]
http://www.mimante.net/

------------------------------------------------------------------------------
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
Imdbpy-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/imdbpy-help

Reply via email to