Re: Python Gotcha's?

2012-04-05 Thread John Gordon
s is fairly pedestrian as gotchas go, but it has bitten me: If you are working with data that is representable as either an integer or a string, choose one and stick to it. Treating it as both/either will eventually lead to grief. Or, in other words: 1 != '1' -- John Gordon

Re: Best way to disconnect from ldap?

2012-04-05 Thread John Gordon
In John Gordon writes: > I'm writing an application that interacts with ldap, and I'm looking > for advice on how to handle the connection. Specifically, how to > close the ldap connection when the application is done. > I wrote a class to wrap an LDAP conne

Re: python module development workflow

2012-04-11 Thread John Gordon
modules? How to package and distribute your own modules once they're finished? How to install modules that other people have developed? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Bas

Re: Converting a string to list for submission to easygui multenterb​ox

2012-05-01 Thread John Gordon
I need to convert this to > this: ['ksals', '', 'alsdkfj', '3', ''] That looks like a tuple which contains five strings. But you said it's a string, so I'll believe you. >>> x = "('ksals', '

Re: Re: Converting a string to list for submission to easygui multenterb​ox

2012-05-01 Thread John Gordon
g.multenterbox(msg1,title, fieldNames, choice) > fieldNames has 5 fields. If you just need to convert a tuple to a list, that's easy. Call the built-in function list() and pass the tuple as an intializer: >>> choice = ('ksals', '', 'alsdkfj', '

How to get outer class name from an inner class?

2012-05-08 Thread John Gordon
r "TooLong". But that's not enough; I also need to know the outer class name, i.e. "Question.TooShort" or "Question.TooLong". How do I get the outer class name? Thanks, -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get outer class name from an inner class?

2012-05-08 Thread John Gordon
In John Gordon writes: > class QuestionTooShortError(NetIDAppsError): > """User entered a security question which is too short.""" > pass > class QuestionTooLongError(NetIDAppsError): > """User entered a security que

Re: Extracting DB schema (newbie Q)

2012-05-14 Thread John Gordon
eyword can't be an expression" error. The general syntax for assigning to a dictionary is: my_dictionary[key] = value What are you trying that isn't working? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.

Re: Carbon Event Manager (Carbon.CarbonEvt module) - working?

2012-05-15 Thread John Gordon
In msmucr writes: > Do I have something wrong or is it simply broken and unmaintained now? We have no idea if you did anything wrong, because you didn't tell us exactly what you did and exactly what error message you received. -- John Gordon A is for Amy, who fell

Re: Object cleanup

2012-05-30 Thread John Gordon
In <6e534661-0823-4c42-8f60-3052e43b7...@googlegroups.com> "psaff...@googlemail.com" writes: > How do I force the memory for these soup objects to be freed? Have you tried deleting them, using the "del" command? -- John Gordon A is for Amy,

Re: Why does this leak memory?

2012-06-07 Thread John Gordon
g that looks like a leak. It reported that there were 19 objects which are unreachable and therefore are candidates for being collected. What makes you think there is a leak? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assa

Re: Of Functions, Objects, and Methods-I NEED HELP PLEASE

2011-06-08 Thread John Gordon
ave a method and a list that are both called dogAppend. Try naming one of them something different. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "

Re: Python 2.6 OR 3.2

2011-06-09 Thread John Gordon
ference If you're starting new, use 3.2. All code will eventually move to this newer style, so you'll have to learn it eventually. The only reason to use 2.6 is if you have to maintain an existing code base that was written with 2.6 (or older). -- John Gordon A is for Amy,

Re: Help with a piping error

2011-06-10 Thread John Gordon
yping it by hand, specifically to avoid errors like this. Please repost a transcript of your real session. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, &

Re: doing cross platform file work

2011-06-22 Thread John Gordon
t, what did you specifically have in mind? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list

Re: LDAP: How get all users belongs to a group.

2011-06-24 Thread John Gordon
t;cn=My-Group-1,ou=Groups,o=CUST", ldap.SCOPE_BASE) for result in results: result_dn = result[0] result_attrs = result[1] if "member" in result_attrs: for member in result_attrs["member"]: print member ldapClient.unbind_s() -- John Gordo

Re: NEED HELP-process words in a text file

2011-06-24 Thread John Gordon
In Cousin Stanley writes: > How or why this behavior was cultivated > and continues to spread is mind boggling The behavior of writing in all caps, or the behavior of equating such writing with shouting? -- John Gordon A is for Amy, who fell down the stai

Re: what's the big deal for print()

2011-06-24 Thread John Gordon
In pipehappy writes: > Why people want print() instead of print str? That's not a big deal > and the old choice is more natural. Anyone has some clue? Because the new Python uses print(). print "str" is the old way. -- John Gordon A is for Amy, who

Re: text file

2011-06-30 Thread John Gordon
e: python samples.py > textfile And it will save the output in "textfile". -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list

Re: Implicit initialization is EXCELLENT

2011-07-05 Thread John Gordon
ctor warns me not to add a link, although perhaps it's > time for recalibration (after all, summer season started) :-) He's not asking for a link to the "Implicit initialization is EVIL" thread; he's asking for a link to the original article he read elsewhere which praised

Re: Implicit initialization is EXCELLENT

2011-07-05 Thread John Gordon
In John Gordon writes: > which praised the bendfists of implicit initialization. Wow, that's quite a typo! I meant "benefits", of course. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil,

Re: i get different answers based on run platform

2011-07-07 Thread John Gordon
ed character hanging at the end of the input line, which upsets the palindromic balance?) By the way, I could not make your program work as you provided it; I had to replace input() with raw_input(). Does it really work for you this way? -- John Gordon A is for Amy, who fell

Re: String concatenation vs. string formatting

2011-07-08 Thread John Gordon
it silly, but I'm a novice when it comes to > design. Plus, there's not really supposed to be "more than one way to do > it" in Python. Concatenation feels ugly/clunky to me. I prefer this usage: logger.error('%s could not be stored - %s' % \ (self.preset_

Re: How to get or set the text of a textfield?

2011-07-10 Thread John Gordon
list of methods that are defined by that object. Hopefully one of them will be called something helpful like set_text() or set_property(). Once you know the method name, you might try a Google search to determine the exact usage and arguments. -- John Gordon A is for Amy, who

Re: How to get or set the text of a textfield?

2011-07-11 Thread John Gordon
-- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list

Re: python error PLS-00306: wrong number or types of arguments in

2011-07-13 Thread John Gordon
None]? It might help if you posted the method signature of the Oracle stored procedure you're trying to call. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward

Re: python error PLS-00306: wrong number or types of arguments in

2011-07-13 Thread John Gordon
ot;, which is the prodecure called by your code. Where is this procedure? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies"

Re: python error PLS-00306: wrong number or types of arguments in

2011-07-13 Thread John Gordon
he OUT variable p, with some value. It doesn't have to be a > cursor fetch; even a minor text assignment. That procedure is defined as taking one parameter, but you're passing an empty parameter list. Why? -- John Gordon A is for Amy, who fell down the stairs gor

Re: python error PLS-00306: wrong number or types of arguments in

2011-07-13 Thread John Gordon
ven't worked with OUT parameters so I don't know if this will work, but try it and see what happens: my_string = "" p = [my_string] c.callproc('c2_pkg.RS22', p); print p -- John Gordon A is for Amy, who fell down the stairs gor...@panix.

Re: python error PLS-00306: wrong number or types of arguments in

2011-07-13 Thread John Gordon
s that is how the example code does it. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list

Re: python error PLS-00306: wrong number or types of arguments in

2011-07-13 Thread John Gordon
ckage, actually works, but > then you lose access to private data; which is while I used a package. Did you try changing RS22 from a procedure to a function inside the package? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for B

Re: Use self.vars in class.method(parameters, self.vars)

2011-07-22 Thread John Gordon
ized. Why did you say he was wrong? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 8 and extraneous whitespace

2011-07-22 Thread John Gordon
is to help the poor sod who will eventually get stuck working with your code on an 80-column fixed width terminal window. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edw

Re: Pipe in the "return" statement

2011-07-25 Thread John Gordon
n; the bitwise OR of both values is computed and that value is returned. It seems that you don't understand what the term "bitwise or" means. Perhaps a Google search might help. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.c

Re: os.path.dirname(sys.argv[0]) always returns nothing

2011-08-01 Thread John Gordon
results from os.path.dirname: >>> import os >>> os.path.dirname('foo.py') '' >>> Are you trying to obtain the full pathname of the program? That's an entirely different question. -- John Gordon A is for Amy, who fell down the s

Re: making my extensions work together

2011-08-03 Thread John Gordon
sure what you mean by "extension", but it might not be relevant. Are these extensions, whatever they may be, part of the same program? Or are they separate? > This doesn't work. When one of my extensions changes the variable value, the > other extension does not see the change.

Re: PyWhich

2011-08-05 Thread John Gordon
In <4e3bf554$0$29976$c3e8da3$54964...@news.astraweb.com> Steven D'Aprano writes: > Doh! I *always* conflate env and which. Thank you for the correction. Way to say "conflate"! :-) -- John Gordon A is for Amy, who fell down the stairs gor...@panix.c

Re: Replace all references to one object with references to other

2011-08-05 Thread John Gordon
that is a very naive solution and can easily fail based on lots of factors. What's your context: A single source file? Many source files? A live application with persistent data? What are your two objects? Do they provide an identical interface? -- John Gordon A is for

Re: Replace all references to one object with references to other

2011-08-05 Thread John Gordon
In John Gordon writes: > In Jack Bates > writes: > > I have two objects, and I want to replace all references to the first > > object - everywhere - with references to the second object. What can I > > try? > The simplest answer to your question is to assign ob

Re: How to solve this problem

2011-08-09 Thread John Gordon
administrators. And what does this question have to do with python? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" --

Re: TypeError: 'module' object is not callable

2011-08-11 Thread John Gordon
s problem when you haven't shown us the code for Univariate. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list

Data issues with Django and Apache

2011-08-13 Thread John Gordon
It almost seems like Apache is maintaining its own persistent session or something, and restarting Apache causes the session to be flushed. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: Data issues with Django and Apache

2011-08-14 Thread John Gordon
x27;m somewhat pressed for time. I was just hoping that someone would recognize the problem from the few symptoms I gave. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edwa

Re: Data issues with Django and Apache

2011-08-15 Thread John Gordon
In John Gordon writes: > The problem is that I get conflicting results as to whether these temporary > records have reached their expiration date, depending if I search for them > via an Apache web call or if I do the search locally from a python shell. > And to make it weirder, t

Re: why i cannot import djang?

2011-08-16 Thread John Gordon
ion you're running, the version number should be displayed when you start up a python shell, like this: command prompt> python Python 2.3.4 (#1, Apr 15 2011, 17:38:51) [GCC 3.4.6 20060404 (Red Hat 3.4.6-11)] on linux2 Type "help", "copyright", "cr

Re: Ten rules to becoming a Python community member.

2011-08-16 Thread John Gordon
t convey the same meaning as "used to wear." "wore" means you have worn them in the past. "used to wear" means you have worn them in the past AND don't intend to do so again. -- John Gordon A is for Amy, who fell dow

Re: Ten rules to becoming a Python community member.

2011-08-16 Thread John Gordon
ure. Not even YOU can predict whether or not Of course -- that's why the word "intend" was part of my answer. Did you overlook that crucial word? I stand by my assertion that the phrase "I used to do X" carries the meaning that you have done X in the past but DO NOT INTEND t

Re: Measure the amount of memory used?

2011-08-18 Thread John Gordon
easured the memory used by a Python program? How did > you do it? I generally use 'top' to do this for any program. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: How to convert a list of strings into a list of variables

2011-08-18 Thread John Gordon
ed", "one", "maple"] list_of_variables = [] for x in list_of_strings: list_of_variables.append(eval(x)) for y in list_of_variables: print y -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assa

Re: Word Perfect integration

2011-08-18 Thread John Gordon
work than learning wordperfect macros. Just my two cents. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail

Re: Help with regular expression in python

2011-08-18 Thread John Gordon
regexp account for the space in between each float? I can't tell due to your post having a linebreak at a really inconvenient spot. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: HTML client sctript

2011-08-19 Thread John Gordon
be better if this script runs from the clients' side. > Could any one suggest any Python modules, articles, tutorials, ect. that > might be helpful? Mechanize seems like what you want. It's built on top of urllib2. http://wwwsearch.sourceforge.net/mechanize/ -- John Gordon

Re: try... except with unknown error types

2011-08-19 Thread John Gordon
s? Thank you. You can catch all exceptions by catching the base class Exception: try: some_method() except Exception, e: print "some error happened, here is the explanation:" print str(e) -- John Gordon A is for Amy, who fell

Re: try... except with unknown error types

2011-08-19 Thread John Gordon
which should be caught. > You should always catch the absolute minimum you need to catch. I agree, but it did seem to be exactly what he was asking for. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for

Re: why i cannot invoke python script using command line?

2011-08-23 Thread John Gordon
l in eclipse > but failed when using python f:\project\src\a.py, what's wrong? > (the error msg shows a.py cannot find b.py) , what should i do in > order to run a.py using command line? What is your PYTHONPATH environment variable setting? -- John Gordon A

Re: there is a problem, holp someone could help me,thanks

2011-08-24 Thread John Gordon
you explain how it works? > Thanks for you help. > Vince When a function calls itself, as fib() does, it's called recursion. http://en.wikipedia.org/wiki/Recursion_(computer_science) Basically the fib() method keeps calling itself with smaller and smaller arguments until it gets 1 or 0.

Re: Learning Python

2011-08-24 Thread John Gordon
; Could some one explain it for me? I can't understand how it works. Reposting the exact same question doesn't help us answer it. Perhaps you could explain why the previous responses weren't helpful. -- John Gordon A is for Amy, who fell down the stairs go

Re: is there any principle when writing python function

2011-08-26 Thread John Gordon
I'm writing a module that needs to fetch user details from an LDAP server, it might be worthwhile to put all of the LDAP-specific code in its own method, even if it's only used once. That way the main module can just contain a line like this: user_info = get_ldap_results("cn=john gord

Re: Unit test failing please help

2011-08-26 Thread John Gordon
, value): > print("setting %s to %s" % (key, repr(value))) > if key in ([]): > self.legs.append(key) > super(Centipede, self).__setattr__(self, key,value) How will this if statement ever be true? You're checking if 'key&#x

Re: Why I need the parameter when the call doesn't use it?

2011-08-28 Thread John Gordon
wouldn't be able to access instance variable x and it wouldn't be able to call say_hello(). If you have a method that doesn't need to access other variables or methods within the class, you can declare it with the @staticmethod decorator. -- John Gordon A is for

Re: Why do class methods always need 'self' as the first parameter?

2011-08-31 Thread John Gordon
ge. How would a method access instance variables without 'self'? They probably could have made 'self' a magical attribute that just appears out of thin air instead of being passed as an argument, like 'this' in C++. But would that really provide any benefit? --

Re: How to structure packages

2011-09-07 Thread John Gordon
In <2a4f542c-a8c1-46c7-9899-a3fad0940...@x11g2000yqc.googlegroups.com> bclark76 writes: > mypackage > __init__.py > myfunc.py > MyClass.py > from mypackage import MyClass Try this instead: from mypackage.MyClass import MyClass -- John Gordon

Re: What do I need to know in order to write a web application in python?

2011-03-04 Thread John Gordon
ou meant by "real-time". -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list

Re: What do I need to know in order to write a web application in python?

2011-03-04 Thread John Gordon
ent environments do I need to use? You might try learning Tkinter; it is python's standard GUI interface package. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears --

Re: Get Path of current Script

2011-03-14 Thread John Gordon
and record their answer -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list

Re: Memory Usage of Strings

2011-03-16 Thread John Gordon
4 1250 1125 1-1 1 5 1000 1000 grand total chars 23024400 The two loops do not produce the same numbers of characters, so I'm not surprised they do not consume the same amount of

Re: Coding and Decoding in Python

2011-03-17 Thread John Gordon
different, but surely that won't always be the case with real data. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies"

Re: Coding and Decoding in Python

2011-03-17 Thread John Gordon
eys and values swapped. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list

Re: value of pi and 22/7

2011-03-18 Thread John Gordon
In <8uh0rcfe1...@mid.individual.net> Neil Cerutti writes: > RIIght. What's a cubit? How long can you tread water? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assa

Re: Writing to a file

2011-03-25 Thread John Gordon
much better. (However, I'm not sure it will do what you were expecting with the tilde in the file path.) -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gor

Re: Dump interpreter history?

2011-03-25 Thread John Gordon
e a file named "typescript" containing all of the input and output which occurred. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list

Re: Dump interpreter history?

2011-04-11 Thread John Gordon
ne argument which is the name of the file to be written." -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list

Re: optparse eats $

2011-04-19 Thread John Gordon
In tazz_ben writes: > So, any ideas? Why is including a $ eating both the dollar signa and the 1? Unix command lines tend to assume any $ inside double-quotes is a shell variable name. Try enclosing in single-quotes instead. -- John Gordon A is for Amy, who fell down

Re: Argument count mismatch

2011-04-21 Thread John Gordon
er of a class? The presence of the "self" parameter suggests that it is, but your code omits this detail. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gor

the core values of the Python "platform"

2017-09-13 Thread Darin Gordon
Bryan Cantrill gave an interesting talk recently at a Node conference about "platform values" [1]. The talk lead me to think about what the core values of the Python "platform" are and I thought it would be good to ask this question of the community. What would you consider the top (<= 5) core valu

Re: errors with json.loads

2017-09-20 Thread John Gordon
r > So "text" seems to be a string. Why does json.loads return an error? Because, although text is the right type, it does not contain a valid json string. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by b

Re: has sourceforge exposed the dirty little secret ?

2018-01-05 Thread John Gordon
hy should software be any different? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- https://mail.python.org/mailman/listinfo/python-list

Re: has sourceforge exposed the dirty little secret ?

2018-01-05 Thread John Gordon
In <151517608506.368831.5093080329614058603@welt.netz> "Kim of K." writes: > print(emo('now you see emos')) > OF COURSE THIS SHIT DOES NOT WORK. What device did you run this on? Your average terminal window isn't going to support emojis... -- John

Re: Where has the practice of sending screen shots as source code come from?

2018-01-29 Thread John Gordon
te column. Without this screenshot, we would have had only the user's (incorrect) assertion that the file existed, and no way to diagnose the true issue. Granted, this was an environment issue and not a code issue, but I can imagine situations where the same sort of thing could apply t

Re: Detection of ultrasonic side channels in mobile devices with Python?

2018-02-28 Thread John Gordon
whack-job newsgroups that would love to > discuss that aspect of it. Sounds like the plot to the latest Kingsman movie. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: How to split value where is comma ?

2016-09-08 Thread John Gordon
for x in newlist: print(x) -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- https://mail.python.org/mailman/listinfo/python-list

Re: Mysterious Logging Handlers

2016-09-09 Thread John Gordon
default logging format; it's used when you haven't supplied any format of your own. The snippet of xlreader.py does not define any format, so it seems like that's where it's coming from. (This seems pretty straightforward; am I missing something?) -- John Gordon

Re: ldap or active directory module

2016-09-09 Thread John Gordon
particular group Do the same search as above, returning the "member" attribute. Get the search result and then inspect the list of returned members. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for

Re: memberof example using ldap

2016-09-12 Thread John Gordon
fine even if group doesn't exist, > It always says that user is member of The query returns a user who is not a member of the named group? That's odd. What is the search base and scope? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com

Re: How to extend a tuple of tuples?

2016-09-12 Thread John Gordon
has been mutated in the very statement that > you are quoting No. An entirely new tuple is created, and 'a' is rebound to it. The existing tuple is not mutated. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assa

Re: Requests for webbrowser module

2016-09-14 Thread John Gordon
controls whether new pages are opened in a new tab or a new window. Perhaps that is your issue? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gash

Re: strings and ints consistency - isinstance

2016-09-21 Thread John Gordon
sented as a string*. The same is not true for integers. * Okay, python 2.7 does have some issues with Unicode. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Go

Re: Why does the insert after list function fail?

2016-09-22 Thread John Gordon
thing; it modifies the existing list in-place. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- https://mail.python.org/mailman/listinfo/python-list

Re: how to append to list in list comprehension

2016-09-30 Thread John Gordon
(0) Or, if you really want to use a list comprehension: [f.append(0) for f in fups if len(f) < 5] However there's no reason to use a list comprehension here. The whole point of list comprehensions is to create a *new* list, which you don't appear to need; you just need to modify

Re: xml parsing with lxml

2016-10-07 Thread John Gordon
child in root: print(child.tag) -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- https://mail.python.org/mailman/listinfo/python-list

Re: Free Python e-books from O'Reilly

2016-10-10 Thread John Gordon
ed that they were all fairly short, none more than 80 pages or so. I suspect these books are somewhat lighter fare than the typical O'Reilly tome. Not necessarily a bad thing, but worth mentioning. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com

Re: Build desktop application using django

2016-10-17 Thread John Gordon
omething which runs locally on your computer, such as Microsoft Word or a game. But Django is for building websites, not local applications. So Django probably isn't what you want. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for B

Re: Inplace shuffle function returns none

2016-10-18 Thread John Gordon
le(a) > print(b[:3]) > For example here i just want to slice the first 3 numbers which should > be shuffled. However you can't slice a noneType object that b becomes. > So how do i get shuffle to give me my numbers? a = [1,2,3,4,5] shuffle(a) print(a[:3]) -- John Gord

Re: Inplace shuffle function returns none

2016-10-18 Thread John Gordon
In <9d24f23c-b578-4029-ab80-f117599e2...@googlegroups.com> Sayth Renshaw writes: > So why can't i assign the result slice to a variable b? Because shuffle() modifies the list directly, and returns None. It does NOT return the shuffled list. -- John Gordon A i

Re: How to handle errors?

2016-10-20 Thread John Gordon
In <8500044a-c8d1-43ad-91d9-e836d52bd...@googlegroups.com> SS writes: > I would like to be able to handle that error a bit better. Any ideas? Wrap the socket.gethostbyname() call in a try/except block. -- John Gordon A is for Amy, who fell down the stairs gor...@

Re: How to handle errors?

2016-10-22 Thread John Gordon
Then I ran it: > ~$ python test.py argument1 argument2 > ['test.py', 'argument1', 'argument2'] Options cannot be passed *on the hash-bang line*. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basi

Re: exist loop by pressing esc

2016-10-24 Thread John Gordon
In <6e030fd0-93c1-4d23-8656-e06c411b6...@googlegroups.com> chris alindi writes: > simple while loop range(10) if user press esc exits loop range() is typically used with for loops, not while loops. what is your while condition? what use is the range() value? -- Jo

After import, some submodules are accessible and some aren't

2016-10-28 Thread John Gordon
object has no attribute 'modlist' >>> ldap.dn >>> import ldap.modlist >>> ldap.modlist Why the difference? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- https://mail.python.org/mailman/listinfo/python-list

Re: Parsing a single-level JSON file

2016-11-18 Thread John Gordon
value. That data looks like a list of dictionaries: import json with open("json.dat", "r") as fp: data = json.load(fp) for item in data: if item['name'] == 'myField2': print item['id'] -

Re: Parsing a single-level JSON file

2016-11-18 Thread John Gordon
In John Gordon writes: > In > mike.rei...@gmail.com writes: > with open("json.dat", "r") as fp: > data = json.load(fp) > for item in data: > if item['name'] == 'myField2': Oops, that should be 'm

<    1   2   3   4   5   6   7   >