Re: [Tutor] LDAP search with ldap library module failing

2013-08-05 Thread Dominik George
Hi,

> Now, if I search fog cn=ab*, a much limited search it will return the search
> results. Thinking that it could be a limitation from the server side, I've 
> done
> the same search with ldapsearch in bash, and it gets what is expected.

Are you sure it gets what is expected? ldapsearch limits the results to
500 - maybe the LDAP library does not. How many entries do you expect?

> I am using ipython, and python 2.6 in a linux OS.

Why are you using such an outdated version? Any chance you upgrade to
Python 2.7?

> My question is: How can I try to debug this issue?

There are several ways, Two are reading the LDAP server logs, and
tcpdumping the connection to see if anything happens. I am pretty
certain that this is not an issue with your code.

> The error message is: ('EOF in multi-line statement', (379, 0))

> --> 519 return 
> self.search_ext_s(base,scope,filterstr,attrlist,attrsonly,None,None,timeout)

This is why I say "never use ipython". The error message is complete
non-sense.

-nik

-- 
* concerning Mozilla code leaking assertion failures to tty without D-BUS *
 That means, D-BUS is a tool that makes software look better
than it actually is.

PGP-Fingerprint: 3C9D 54A4 7575 C026 FB17  FD26 B79A 3C16 A0C4 F296


signature.asc
Description: Digital signature
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] LDAP search with ldap library module failing

2013-08-05 Thread Dave Angel
Antonio de la Fuente wrote:

> * Dominik George  [2013-08-05 12:45:42 +0200]:

>
>> > The error message is: ('EOF in multi-line statement', (379, 0))
>> 
>> > --> 519 return 
>> > self.search_ext_s(base,scope,filterstr,attrlist,attrsonly,None,None,timeout)
>> 
>> This is why I say "never use ipython". The error message is complete
>> non-sense.
>> 
>
> I will also try with IDLE.

Consider using the shell window and just running python.  it seems like
every IDE or pseudo-IDE tries to be helpful, and frequently misses the
mark.  The terminal will show you the unmodified traceback,

I'm not saying never use an IDE.  A good one is very useful for certain
things.

But when it interferes with the job, run without it.

-- 
DaveA

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to extract numerator and denominator from fractions.Fraction(4, 32)?

2013-08-05 Thread Dominik George
Hi,

how about casting to str()?

-nik



"Richard D. Moores"  schrieb:
 import fractions
 fractions.Fraction(6, 21)
>Fraction(2, 7)
>
>How do I turn that Fraction(2, 7) into "1/7"? (and not
>0.2857142857142857...)
>
>Or do I have to employ fractions.gcd?
>
>I can't seem to find the answer in the doc at
>
>
>Thanks,
>
>DIck Moores
>___
>Tutor maillist  -  Tutor@python.org
>To unsubscribe or change subscription options:
>http://mail.python.org/mailman/listinfo/tutor

-- 
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to extract numerator and denominator from fractions.Fraction(4, 32)?

2013-08-05 Thread Alan Gauld

On 05/08/13 16:49, Amit Saha wrote:


Ah, better yet! Thanks! But where could I have found that in
?


Sometimes, you may also want to do dir() on an object to see what
attributes/methods it has/supports.


Also
>>> help(fractions.Fraction)

yields lots of details including the following:

...
 |  --
 |  Data descriptors defined here:
 |
 |  denominator
 |
 |  numerator
 |



HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Start multiple threads from Python

2013-08-05 Thread Ryan Waples
Python 2.7.x on Windows 7.

I'm looking for a bit of advice, not sure how to proceed.

With Python I am generating a file with a bunch of data in it.  I want to
analyse the data in this file with three separate programs.  Each of these
programs is single threaded needs only read access to the data, and they do
not depend on each other.

Currently I am calling each analysis program one at a time with
subprocess.call(). This is working without a hitch, but as each analysis
can take a while to run, I want to try to speed things up.  I realize I can
start three different python sessions to do this, but that just begs the
question how to do that from python?

How can I start multiple independent programs (as in subprocess.call())
without waiting for them to finish?

-Thanks
Ryan
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Start multiple threads from Python

2013-08-05 Thread Ryan Waples
Thanks, that may be just what I'm looking for.

-ryan


On Mon, Aug 5, 2013 at 12:26 PM, Chris Down  wrote:

> On 2013-08-05 12:17, Ryan Waples wrote:
> > Currently I am calling each analysis program one at a time with
> > subprocess.call(). This is working without a hitch, but as each analysis
> > can take a while to run, I want to try to speed things up.  I realize I
> can
> > start three different python sessions to do this, but that just begs the
> > question how to do that from python?
>
> subprocess.Popen does not block unless you explicitly tell it to (by using
> communicate()). Perhaps that's what you want.
>
> >>> import subprocess
> >>> x = subprocess.Popen([ "sleep", "60" ])
> >>> y = subprocess.Popen([ "sleep", "60" ])
> >>> x.pid
> 3035
> >>> y.pid
> 3036
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor