Re: Typing letters slowly using sys

2013-04-05 Thread John Gordon
life of me figure out how to get the dots to appear on > the same line as "Loading". Every way that I have attempted, the word > "Loading" appears and then the dots appear on the next line. How are you printing the "Loading" text? (It would have helped a l

Re: Typing letters slowly using sys

2013-04-05 Thread John Gordon
wly Have you tried: sys.stdout.write('Loading') sys.stdout.flush() -- 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: a couple of questions: pickling objects and strict types

2013-04-05 Thread John Gordon
errors such as using a variable name before it's defined. For that, you can use an external program such as pylint or pyflakes. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: I hate you all

2013-04-05 Thread John Gordon
istent. You can't mix tabs and spaces for lines of code at the same indentation level. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlyc

Re: Python pdb bug, followed by bug in bugs.python.org

2013-04-09 Thread John Gordon
ication email, and got some other form of= > brokenness in reply. > Suggestions? Post the 10-line program here, so others can verify whether it is a bug. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: a couple of things I don't understand wrt lists

2013-04-16 Thread John Gordon
our example both rule[0] and rule[1] are zero, so I don't know why '1' ever got printed. Also, as far as I can tell, this code should not have worked at all: for i in range(rule): print rule[i] The range() function expects an integer, not a list. -- John Gordon

Re: Encoding NaN in JSON

2013-04-17 Thread John Gordon
string* 'N/A' for every NaN. import math x = possibly_NaN() if math.isnan(x): x = 'N/A' -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gore

Re: Novice Issue

2013-04-18 Thread John Gordon
put() while user_input != "quit" or user_input != "q": There is still a logic bug. This loop will execute forever, because no matter what the user enters, it will be unequal to "q" or unequal to "quit". Use 'and' instead of 'or'. Of

Re: Strange behavior for a 2D list

2013-04-18 Thread John Gordon
lecting every third element after that (and there are only two elements, so it stops after the first one): [[7, 8, 9, 10, 11, 12, 13]] Why were you expecting the other result? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for B

Re: How to set my gui?

2013-04-18 Thread John Gordon
In <5170648d$0$1368$4fafb...@reader2.news.tin.it> Tracubik writes: > i suppose i've to first generate the window and than populate it, but > where i've to put the "search for occurences" code? I don't think init() > is the right place.. What GUI

Re: unzipping a zipx file

2013-04-19 Thread John Gordon
In "b_erickson1" writes: > ozFile = open(filename,'w') > ozFile.write(zFile.read(filename)) > ozFile.close() Perhaps you want to use zFile.extract() instead of zFile.read()? -- John Gordon A is for Amy,

Re: unzipping a zipx file

2013-04-19 Thread John Gordon
In John Gordon writes: > In "b_erickson1" > writes: > > ozFile = open(filename,'w') > > ozFile.write(zFile.read(filename)) > > ozFile.close() > Perhaps you want to use zFile.extract() instead of zFile.rea

Re: How to connect to a website?

2013-04-22 Thread John Gordon
.voidspace.org.uk') response = urllib2.urlopen(request) content = response.readlines() -- 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: datetime.strptime() not padding 0's

2013-04-23 Thread John Gordon
etime.strptime('Apr 9 2013', '%b %d %Y') > >>> dt.day > 9 > How can I get strptime to run 09? instead of 9 dt.day is just an integer. If you want to print it with zero padding, use a format string: >>> n = 9 >>> print n 9 >>> print

Re: how to: multiplayer game connecting to central server effectively?

2013-04-24 Thread John Gordon
aper). But a truly interactive game would probably require something more, like an active socket connection. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, &quo

Re: Passing special characters in soap data

2013-04-30 Thread John Gordon
> Since i pass this data into my python script as a command line call, i get > the error: > /bin/sh: Syntax error: Unterminated quoted string Can you modify your python script so it accepts a filename which contains the xml? -- John Gordon A is for Amy, who fell

Re: First python program, syntax error in while loop

2013-05-03 Thread John Gordon
it..") > ## what is wrong with this script? I'm just trying to understand while loops > and ## this is not a real project :P You're missing a second closing parentheses on the line where the user inputs their guess. Also, you need to indent the 'if'

Re: First python program, syntax error in while loop

2013-05-03 Thread John Gordon
le guess != number: ^ SyntaxError: invalid syntax -- 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: First python program, syntax error in while loop

2013-05-03 Thread John Gordon
t; raw_input("\n\n Press any key to exit..") > ## it seems to stick with "higher" or "lower" after my first guess, whichever > it > ## is When the user re-enters their guess in the while loop, you're assigning the

Re: First python program, syntax error in while loop

2013-05-03 Thread John Gordon
t;, tries, "tries" else: print "Sorry, you lost!" -- 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: First python program, syntax error in while loop

2013-05-03 Thread John Gordon
In Neil Cerutti writes: > Not quite yet. Players who guess correctly on the fifth try don't > get credit. Are you sure? tries is initialized to zero and isn't incremented for the initial guess. -- John Gordon A is for Amy, who fell down the stairs

com_error 'Exception occurred'

2007-06-02 Thread Richard Gordon
I've got a fatal bug using Parente's pyTTS with Python 2.3 on Windoze 32 using MS SAPI 5.1 and Hammond's win32 module. The test program is import pyTTS tts = pyTTS.Create() tts.Speak('Hello world.') The resulting debug trace is: PythonWin 2.3.5 (#62, Feb 8 2005, 16:23:02) [MSC v.1200 32

Please help! win32 com_error 'Exception occurred'

2007-06-02 Thread Richard Gordon
I've got a fatal bug using Parente's pyTTS with Python 2.3 on Windoze 32 using MS SAPI 5.1 and Hammond's win32 module. The test program is import pyTTS tts = pyTTS.Create() tts.Speak('Hello world.') The resulting debug trace is: PythonWin 2.3.5 (#62, Feb 8 2005, 16:23:02) [MSC v.1200 32

Need help! win32 com_error 'Exception occurred'

2007-06-02 Thread Richard Gordon
I've got a fatal bug using Parente's pyTTS with Python 2.3 on Windoze 32 using MS SAPI 5.1 and Hammond's win32 module. The test program is import pyTTS tts = pyTTS.Create() tts.Speak('Hello world.') The resulting debug trace is: PythonWin 2.3.5 (#62, Feb 8 2005, 16:23:02) [MSC v.1200 32

Help with win32 com_error exception

2007-06-02 Thread Richard Gordon
Sorry if this is sent twice, but I didn't see it get posted the first time. I've got a fatal bug using Parente's pyTTS with Python 2.3 on Windoze 32 using MS SAPI 5.1 and Hammond's win32 module. The test program is import pyTTS tts = pyTTS.Create() tts.Speak('Hello world.') The resulting de

Reaching the real world

2007-06-06 Thread Blackwell, Gordon
PROTECTED] Many thanks in advance Gordon Blackwell Dr. G.B. Blackwell Senior Chemist Dentsply DeTrey DeTrey Strasse 1 D-78467 Konstanz Tel. +49 07531 583214 -- http://mail.python.org/mailman/listinfo/python-list

idiom for RE matching

2007-07-18 Thread Gordon Airporte
I have some code which relies on running each line of a file through a large number of regexes which may or may not apply. For each pattern I want to match I've been writing gotit = mypattern.findall(line) if gotit: gotit = gotit[0] ...do whatever else... This seems kind of clun

Re: A way to re-organize a list

2007-07-19 Thread Gordon Airporte
beginner wrote: > > What I want to do is to reorganize it in groups, first by the middle > element of the tuple, and then by the first element. I'd like the > output look like this: itertools.groupby has already been mentioned, but it has a very specific and complex behavior which may not be exa

Re: searching algorithm

2007-05-10 Thread Gordon Airporte
> For the above (abrideged) dictionary, you would generate (use a > fixed-width "programmers" font so the tree looks good): > > a > | > b > | > s > / \ >i o > / /

py2exe LoadLibrary question

2007-05-11 Thread gordon . chapman
Yep, it's the old LoadLibrary failed problem. I understand that python24.dll is required for the executable to run, but I'm going to be building a few of these executables and I don't want to have to bundle python24 along with each one. We have python24.dll installed in c:/windows/system32, why i

ClientForm .click() oddity

2007-05-14 Thread Gordon Airporte
I've written a script using ClientForm to automate opening and closing ports on my Linksys router. It works, but I wonder if there isn't a better way to do it. The problem is that the list of arguments in the request generated by .click()ing the form is incomplete and I have to edit it manually.

Re: itertools.groupby

2007-05-28 Thread Gordon Airporte
7stud wrote: > Bejeezus. The description of groupby in the docs is a poster child > for why the docs need user comments. Can someone explain to me in > what sense the name 'uniquekeys' is used this example: > This is my first exposure to this function, and I see that it does have some uses in

Re: itertools.groupby

2007-05-28 Thread Gordon Airporte
Paul Rubin wrote: > It chops up the iterable into a bunch of smaller ones, but the total > size ends up the same. "Telescope", "compact", "collapse" etc. make > it sound like the output is going to end up smaller than the input. Good point... I guess I was thinking in terms of the number of iter

Where is the collections module?

2007-07-22 Thread Gordon Airporte
I was going to try tweaking defaultdict, but I can't for the life of me find where the collections module or its structures are defined. Python 2.5. -- http://mail.python.org/mailman/listinfo/python-list

Re: idiom for RE matching

2007-07-22 Thread Gordon Airporte
[EMAIL PROTECTED] wrote: > Have you read and understood what MULTILINE means in the manual > section on re syntax? > > Essentially, you can make a single pattern which tests a match against > each line. > > -- Michael Dillon No, I have not looked into this - thank you. RE's are hard enough to g

Re: Where is the collections module?

2007-07-22 Thread Gordon Airporte
Gordon Airporte wrote: > I was going to try tweaking defaultdict, but I can't for the life of me > find where the collections module or its structures are defined. Python > 2.5. Thanks all. I was expecting it in Python. Time to dust off my C :-P -- http://mail.python.org/ma

Re: idiom for RE matching

2007-07-23 Thread Gordon Airporte
[EMAIL PROTECTED] wrote: > if your search is not overly complicated, i think regexp is not > needed. if you want, you can post a sample what you want to search, > and some sample input. I'm afraid it's pretty complicated :-). I'm doing analysis of hand histories that online poker sites leave for

Re: idiom for RE matching

2007-07-24 Thread Gordon Airporte
Gabriel Genellina wrote: > As is often the case, a regular expression is NOT the right tool to use > in this case. > > --Gabriel Genellina Very interesting, thank you. I think 'pattern matching' and I automatically think 'regular expressions'. I did already find that it speeds things up to pre

Re: idiom for RE matching

2007-07-25 Thread Gordon Airporte
Miles wrote: > On 7/24/07, Gordon Airporte <[EMAIL PROTECTED]> wrote: >> I did already find that it speeds things up to pre-test a line like >> >> if 'bets' or 'calls' or 'raises' in line: >> run the appropriate re's >

Re: idiom for RE matching

2007-07-25 Thread Gordon Airporte
Ben Finney wrote: > > Not that I want to pick on you; I just don't want something wrong > labelled as "proper" to go unchallenged in the archives :-) Oh gawd :-P I swear I have it right in the actual file! heh. Copy and paste something that's compiled kids, copy and paste. -- http://mail.pytho

Re: Any way to monitor windows network connection?

2007-07-31 Thread Gordon Airporte
momobear wrote: > hi, Is there any way to show me detailed listings of all TCP and UDP > endpoints in my microsoft windows XP in python way? > thanks. Unless you're looking for a programming exercise: http://www.microsoft.com/technet/sysinternals/Utilities/TcpView.mspx -- http://mail.python.org/

Heterogeneous lists

2007-08-07 Thread Gordon Airporte
This is one of those nice, permissive Python features but I was wondering how often people actually use lists holding several different types of objects. It looks like whenever I need to group different objects I create a class, if only so I can use more meaningful names than '[2]' for the items

thread safe SMTP module

2007-03-02 Thread Gordon Messmer
I believe that I've seen this discussed previously, so maybe there's some interest in it. I wrote a threaded mail filtering framework a while ago, and one of the modules does address verification via SMTP. Since smtplib.SMTP uses blocking IO, it can block the whole interpreter. Sometimes the

Re: thread safe SMTP module

2007-03-04 Thread Gordon Messmer
Aahz wrote: > > That doesn't make any sense. Blocking I/O generally releases the GIL, > which is the whole reason Python doesn't totally suck for threading. Nevertheless, among the caveats listed at http://docs.python.org/lib/module-thread.html is: "Not all built-in functions that may block wa

Re: thread safe SMTP module

2007-03-04 Thread Gordon Messmer
Aahz wrote: > > Assuming you have correctly tracked down the problem area, I would call > that a thread bug in Python. But my experience is that you simply have > run into a problem with the socket. I would suggest that using > socket.setdefaulttimeout() would work just as well. I believe that

Watching a file another app is writing

2007-03-11 Thread Gordon Airporte
I'm trying to find a way to take a file that another program has opened and writes to periodically, open it simultaneously in Python, and automatically update some of my objects in Python when the file is written to. I can open the file and manually readlines() from it to keep up to date, it's

Re: Watching a file another app is writing

2007-03-11 Thread Gordon Airporte
Nick Vatamaniuc wrote: > You might need to look at pywin32 for Windows specific ways to listen > to "file changed" event. > > On Unix a quick shortcut would be to simply read the output of 'tail - > f ' command... Ah, I forgot I have Cygwin installed, so I do have tail. Unfortunately Windows w

Re: Watching a file another app is writing

2007-03-12 Thread Gordon Airporte
Gabriel Genellina wrote: > This article explains it in detail: > http://tgolden.sc.sabren.com/python/win32_how_do_i/watch_directory_for_changes.html > > > BTW, it's the top result on Google for "python notify file change windows" > > --Gabriel Genellina Ah, excelent. Thank you. I'd started w

Re: Watching a file another app is writing

2007-03-12 Thread Gordon Airporte
Vishal Bhargava wrote: > What kind of file is it? CSV? It's a hand history file generated by an online poker client, thus it probably keeps it's data pretty much to itself otherwise, and in any case I'm not a Windows programmer so I probably don't have the stomach to get very deep into its proc

Arrays

2007-11-12 Thread Gordon C
Absolute newbie here. In spite of the Python Software Foundation tutorial's ( http://www.python.org/doc/current/tut/tut.html ) use of the array declaration array(type[,initializer]), the Python interpreter does NOT accept the word array! It , presumably, needs to have an import included. Coul

Re: Arrays

2007-11-13 Thread Gordon C
OK, thanks to all. The key statement is "from array import array" which is not exactly intuitive! Gord "John Machin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Bernard wrote: >> On 12 nov, 20:19, "Gordon C" <[EMAIL PROTEC

Re: Arrays

2007-11-13 Thread Gordon C
OK Steve, But why do we say "from array import array" and NOT "from math import math"? Why the difference in syntax? Gord "Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Tue, 13 Nov 2007 11:26:28 -0500, Gor

Re: Limit Guessing Algorithm

2007-12-03 Thread Gordon C
One of the difficulties of this kind of a problem is that one is looking for a solution to a limited number of data points for which it may be possible to define a function. There can never be a guarantee that the chosen "fit" can be reliably extrapolated. You need to tie a possible solution to

Re: recognize a drive as removable media (e.g. compact flash, sd card or usb drive)

2006-05-02 Thread Gordon Rainsford
ovable ones, and then read stuff > off them. Any suggestions as to doing this on a Mac? -- Gordon Rainsford -- http://mail.python.org/mailman/listinfo/python-list

Re: alternating string replace

2008-01-09 Thread Gordon C
This is very cool stuff but I suspect that the code is unreadable to many readers, including me. Just for fun here is a complete program, written in Turbo Pascal, circa 1982, that does the job. Readable n'est pas? Program dash; var str: string[80]; n: integer; odd: boolean; begin

Beta testers needed for a high performance Python application server

2008-03-25 Thread Minor Gordon
Hello all, I'm looking for beta testers for a high performance, event-driven Python application server I've developed. About the server: the front end and other speed-critical parts of the server are written in portable, multithreaded C++. The back end is an embedded CPython interpreter. The s

[Fwd: Beta testers needed for a high performance Python application server]

2008-03-25 Thread Minor Gordon
One thing I forgot to add: the code is GPLv2, though I'll consider alternative licenses for specific users. Original Message Subject: Beta testers needed for a high performance Python application server Date: Tue, 25 Mar 2008 20:31:39 + From: Minor Gordon &l

Re: Getting namespaces right when parsing/executing Python ASTs

2008-10-07 Thread Gordon Fraser
trying to make sense of the manual for eval, as it says if the passed globals dict lacks '__builtins__' it will copy the current globals, and if no dict is passed it will use the current globals (so what's the difference?). But anyway, as long as it works I'm happy! Thanks, Gord

Getting namespaces right when parsing/executing Python ASTs

2008-10-07 Thread Gordon Fraser
Hi, I'm trying to parse Python code to an AST, apply some changes to the AST and then compile and run the AST, but I'm running into problems when trying to evaluate/execute the resulting code object. It seems that the global namespace differs depending on where I call parse and eval/exec. The fol

extracting null pointer address from PyCObject with ctypes

2008-10-10 Thread Gordon Allott
Hello :) The result of various incompatibilities has left me needing to somehow extract the address that a null pointer is pointing to with the null pointer being exposed to python via PyCObject_FromVoidPtr the code that creates the PyCObject is as follows: tmp = PyCObject_FromVoidPtr (info.i

Re: extracting null pointer address from PyCObject with ctypes

2008-10-10 Thread Gordon Allott
Aaron "Castironpi" Brady wrote: > Did you try: > > tmp= PyLong_FromLong( ( long ) info.info.x11.display ); > PyDict_SetItemString (dict, "display", tmp); > Py_DECREF (tmp); > > Or also try: > > PyCObject_AsVoidPtr( tmp ); > -- > http://mail.python.org/mailman/listinfo/python-list the problem is

Re: extracting null pointer address from PyCObject with ctypes

2008-10-10 Thread Gordon Allott
Aaron "Castironpi" Brady wrote: > I see. If I understand, you have a PyCObject in a dictionary. > > Look at the 'ctypes' module and try calling PyCObject_AsVoidPtr. Its > return type should be 'c_void_p', and you can use 'result.value' to > get the original pointer. > -- > http://mail.python.org

Re: extracting null pointer address from PyCObject with ctypes

2008-10-10 Thread Gordon Allott
Aaron "Castironpi" Brady wrote: > Yes, well said. But no, not true, not necessarily. You can choose/ > change return types with your code. If the call is defined already > and you can't change the return, just define a new one that returns > long. > -- > http://mail.python.org/mailman/listinfo/

Re: extracting null pointer address from PyCObject with ctypes

2008-10-10 Thread Gordon Allott
Aaron "Castironpi" Brady wrote: > > You are hard to follow. There is the 'cast' function, which I've had > some success with, even in adding pointers and offsets. It took a > look at the code for it though, and calling an undocumented version of > it. I can post that later if you don't have luc

Re: extracting null pointer address from PyCObject with ctypes

2008-10-11 Thread Gordon Allott
Aaron "Castironpi" Brady wrote: > > My pygame install just returns an integer in get_wm_info. Take a > look: > pygame.display.get_wm_info() > {'window': 1180066, 'hglrc': 0} pygame.display.get_wm_info()['window'] > 1180066 ctypes.c_void_p( _ ) > c_void_p(1180066) > > You're sugge

Re: extracting null pointer address from PyCObject with ctypes

2008-10-11 Thread Gordon Allott
Aaron "Castironpi" Brady wrote: > > What does print pythonapi.PyCObject_AsVoidPtr(display) give you? > -- > http://mail.python.org/mailman/listinfo/python-list Traceback (most recent call last): File "pygametest.py", line 125, in app = PyGameOGREApp() File "pygametest.py", line 33, in __

Re: extracting null pointer address from PyCObject with ctypes

2008-10-11 Thread Gordon Allott
Aaron "Castironpi" Brady wrote: ctypes.pythonapi.PyCObject_AsVoidPtr.restype > ctypes.pythonapi.PyCObject_AsVoidPtr.argtypes thank you so much, this works perfectly :) -- Gord Allott ([EMAIL PROTECTED]) signature.asc Description: OpenPGP digital signature -- http://mail.pytho

ldap package question

2009-03-17 Thread John Gordon
h server I'm connected to? -- 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: The Importance of Terminology's Quality

2008-05-30 Thread Gordon Etly
Lew wrote: > John Thingstad wrote: > > Perl is solidly based in the UNIX world on awk, sed, bash and C. > > I don't like the style, but many do. > Please exclude the Java newsgroups from this discussion. Why? Do you speak for everyone in that, this, or other groups? -- G.Etly -- http://mai

Inserting cookies into a web session

2008-07-23 Thread John Gordon
s? And are there any back-end requirements? I assume you would have to be running a webserver that supports sessions. Do you also have to be running some sort of web container or servlet engine? Thanks for any suggestions. -- John Gordon A is for Amy, who fell down the stairs [EMAIL PR

Re: Inserting cookies into a web session

2008-07-24 Thread John Gordon
In <[EMAIL PROTECTED]> =?ISO-8859-1?Q?Michael_Str=F6der?= <[EMAIL PROTECTED]> writes: > John Gordon wrote: > > I'm developing a web application that needs a semi-persistent way to > > store information. > > > > I've looked at some options s

Defunct when using subprocess.Popen

2008-07-29 Thread Gordon Maria
Title: Defunct when using subprocess.Popen Hi! I hope someone can help me out here! I'm running a GUI in python which is able to launch a separate python process that will run forever. In rare cases I will want to kill the launched process. Every time I do so, I end up with the process as

Defunct when using subprocess.Popen

2008-07-29 Thread Gordon Maria
Title: Defunct when using subprocess.Popen Hi! I hope someone can help me out here! I'm running a GUI in python which is able to launch a separate python process that will run forever. In rare cases I will want to kill the launched process. Every time I do so, I end up with the process as

Re: Repeated output when logging exceptions

2009-09-28 Thread John Gordon
what > functionality do you lose? I'm trying to encapsulate all the setup work that must be done before any actual logging occurs: setting the debugging level, choosing the output filename, declaring a format string, adding the handler, etc. If I didn't do all that in a class, where would I do

questions regarding stack size use for multi-threaded python programs

2009-11-09 Thread Eyal Gordon
Hi, background: we are using python 2.4.3 on CentOS 5.3 with many threads - and our shell's default stack size limit is set to 10240KB (i.e. ~10MB). we noticed that python's Threading module appears to create threads with this value as their stack size (we ran a sample program that creates 10 thr

Re: New to Python

2010-02-09 Thread John Gordon
;: notfound I have no idea why it would have worked otherwise for you. When you posted your question, did you type the code by hand? Perhaps you made a mistake. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted

Re: Few Small Questions Regarding CGI

2010-02-15 Thread John Gordon
address. Assuming you're running Windows, have a look at this page to download the Apache web server: http://mirror.candidhosting.com/pub/apache/httpd/binaries/win32/README.html -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for B

If/then style question

2010-12-16 Thread John Gordon
se it eliminates a lot of indentation. However I recall one of my college CS courses stating that "one entry, one exit" was a good way to write code, and this style has lots of exits. Are there any concrete advantages of one style over the other? Thanks. -- John Gordon A

Re: Installing dependencies in Windows

2011-02-22 Thread John Gordon
do I put them? (I assume the .so files will be .dll in Windows, but I > dont know where to get these, put these) Anyone have a clue on this? > Thanks. I got the libxml files from http://pypi.python.org/pypi/lxml/2.3 and then following the Downloads link. On my local Windows (XP) ma

Re: Q: finding distance between 2 time's

2009-06-29 Thread John Gordon
In <023130ef$0$19421$c3e8...@news.astraweb.com> Steven D'Aprano writes: > > if time_difference < 3601: > That's a potential off-by-one error. [...] The right test is: > if time_difference <= 3600: Aren't those two comparisons the same? -- Joh

Interface to Exchange Calendar via web services

2009-08-13 Thread John Gordon
r. 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

Web Services examples using "raw" xml?

2009-08-24 Thread John Gordon
good examples of code that builds a "raw" xml SOAP message and sends it to a webserver, then reads the response? I think that would be a good place for me to start. Thanks for any replies. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com

Re: Web Services examples using "raw" xml?

2009-08-25 Thread John Gordon
where I'm stuck at the moment. I have no idea why self.wsdl.services isn't getting populated correctly -- or even if that's the real problem! Any suggestions? -- 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: Web Services examples using "raw" xml?

2009-08-30 Thread John Gordon
In <4a92ee38$0$1627$742ec...@news.sonic.net> John Nagle writes: > John Gordon wrote: > > I'm developing a program that will use web services, which I have never > > used before. > Web services in general, or some Microsoft interface? Microsoft. Exchan

Unexpected 411 error response using httplib

2009-08-31 Thread John Gordon
SoapMessage) resp = conn.getresponse() body= resp.read() headers = resp.msg version = resp.version status = resp.status reason = resp.reason conn.close() print "Response: ", status, reason print "Headers: ", headers print body -----

Different results for request() vs putrequest()

2009-09-03 Thread John Gordon
conn.endheaders() conn.send(body) vs headers = { "Proxy-Authorization": myProxy } conn = httplib.HTTPSConnection(host) conn.request("POST", url, body, headers) And yet they are not. The first section works, but I get an "HTTP/1.1 401 Unauthorized" error from

Re: Different results for request() vs putrequest()

2009-09-11 Thread John Gordon
In John Gordon writes: > According to the documentation, these two sections of code should be > equivalent: > conn = httplib.HTTPSConnection(host) > conn.putrequest("POST", url) > conn.putheader("Proxy-Authorization", myProxy) > conn.puthe

Re: Unexpected 411 error response using httplib

2009-09-11 Thread John Gordon
In John Gordon writes: > As you can see, I am including the call to putheader() for Content-Length, > and the debugging output confirms that the header is present in the outgoing > message. > So why am I getting a 411 Length Required error? To follow up my own post, this was happe

Repeated output when logging exceptions

2009-09-24 Thread John Gordon
lines, and body text. Why is this happening? I suspect it's because I'm declaring two instances of the exceptionLogger class, which ends up calling logger.addHandler() twice. Is that right? What would be a better way to handle this? 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 add months to a date (datetime object)?

2017-02-06 Thread John Gordon
> > end_date = start_date + relativedelta(months=delta_period) + > > timedelta(days=-delta_period) > Where do you define 'delta_period', and what is your question? There is no question; it is an answer in response to the original post asking how to add months to a datet

Re: What's the neatest way of getting dictionary entries in a specified order?

2017-03-13 Thread John Gordon
ndividually, so I would think > the order of the dict's fields does not matter since you'd manually > specify each field's data. The original example used a loop to get all of the dict fields and add them to the GUI, instead of adding each field individually. -- John Gord

Re: Quick questions about globals and database connections

2017-04-05 Thread John Gordon
conn = psycopg2.connect(cstr) return conn.cursor() def updatedb(dbtype): db = dbconnect(dbtype) db.execute("DML code") print "updated " + dbtype 'close connection It would probably be even better to return conn, as that would allow upda

Re: Visit All URLs with selenium python

2017-04-13 Thread John Gordon
rl in the loop? -- 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 add new tuple as key in dictionary?

2017-07-05 Thread John Gordon
= groupkey[tuple([0,3])] + [[0,1]] The right-hand side of your expression is rightly complaining that groupkey[(0,3)] doesn't exist. Would you expect to say a = a + 1 When a doesn't exist? Your code tries to do much the same thing. -- John Gordon A is for Am

Re: get value from list using widget

2017-07-05 Thread John Gordon
u actually mean that *you* want to select a value in your code? I could go on, but you get my point. We need lots more information before we can even begin to help you. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com

Re: Proposed new syntax

2017-08-10 Thread John Gordon
200)] [100, 101, 102, 103, 104, 200, 201, 202, 203, 204] -- 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: Case-insensitive string equality

2017-08-31 Thread John Gordon
much less frequently.) -- 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: Syntactic sugar for assignment statements: one value to multiple targets?

2011-08-03 Thread Katriel Cohn-Gordon
On Wed, Aug 3, 2011 at 9:25 AM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > gc wrote: > > > Target lists using comma separation are great, but they don't work > > very well for this task. What I want is something like > > > > a,b,c,d,e = *dict() > > a, b, c, d, e = [dict() for

Re: making my extensions work together

2011-08-04 Thread Katriel Cohn-Gordon
Wrap your 3rd party library with a Python interface module, and run all calls from foo and goo through your interface. On Thu, Aug 4, 2011 at 2:48 PM, Mathew wrote: > more info. I have a large 3rd party library with a function that looks > like > this > void dumbfunc() { > static int statevar=0

Re: Embedded python console and FILE* in python 3.2

2011-08-08 Thread Katriel Cohn-Gordon
Is the `code` module (http://docs.python.org/library/code.html) an insufficiently exact copy of an interpreter for you? On Mon, Aug 8, 2011 at 4:17 PM, Francis Labarre wrote: > Hello everyone, > > I'm currently trying to port some embedded code from python 2.7 to python > 3.2. > > The current co

<    1   2   3   4   5   6   7   >