Re: Python (and me) getting confused finding keys

2009-12-23 Thread John
> The lesson of this? Do not make mutable classes hashable. That could be it! I'll try. Thanks a lot! > The obvious follow-up is to ask how to make an immutable class. > > http://northernplanets.blogspot.com/2007/01/immutable-instances-in-python.h > tml > -- http://mail.python.org/mailman/lis

"cx_Freeze.freezer.ConfigError: no initscript named Console"

2009-10-01 Thread John
cx_freeze v4.01 Python 2.6 Ubuntu Jaunty Following the example of 'cx-freeze hello.py', I'm getting the error message below. I put all of the error keywords into google and found no hits. Some people in various posts have said to use Python 2.5 but a lot of my code is using Python 2.6 features.

cx_freeze problem on Ubuntu

2009-10-01 Thread John
Sorry if this might be a repost. I'm having problems with my newsreader. My system: cx_freeze 4.1 Python 2.6 Ubuntu Jaunty I downloaded the cx_freeze source code from http://cx-freeze.sourceforge.net/ into a directory. I wrote a one line python program 'print( "hello world" )' According to

Re: cx_freeze problem on Ubuntu

2009-10-01 Thread John
te 'Firstly' which implies a 'Secondly' which you failed to add. You lose -1 points. You gained +1 points for your perspicacity to minutia. You lose -2 points to help resolve the problem. Life is all about gaining points, even if no one cares. Cheers, John, -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular expression to structure HTML

2009-10-02 Thread John
iline strings * consider using the re.X, re.M, and re.S options for re.compile() * save your re object after you compile it * note that re.sub() returns a new string Also, it sounds like you want to replace the first 2 elements for each element with their content separated by a pipe (throwing away the tags themselves), correct? ---John -- http://mail.python.org/mailman/listinfo/python-list

student question

2011-01-07 Thread John
>>> q_file = open(questions_location) #opens the document successfully >>> for line in q_file: print line # prints document successfully >>> line # prints last line of document >>> for line in q_file: print line # prints nothing ...why does it print nothing? -- ht

Re: student question

2011-01-07 Thread John
On Jan 7, 6:47 pm, Corey Richardson wrote: > On 01/07/2011 09:42 PM, John wrote: > > >>>> q_file = open(questions_location) #opens the document successfully > >>>> for line in q_file: > >            print line > > > # prints document successf

Re: parse html rendered by js

2011-02-12 Thread john
Even though I've never tried it, you may want to look into running the html thru a separate javascript engine, like spidermonkey or rhino, and then parse the results of that. On Friday, February 11, 2011 2:20:32 AM UTC-6, yanghq wrote: > hi, > I wanna get attribute value like href,src... in

Re: if, continuation and indentation

2010-05-29 Thread john
gt;  > looks better. Although this won't fix all ugly cases in that problem.. >  > >  > if (width, height, color, emphasis) == (0, 0, 'red', 'strong') or >  > highlight > 100: >  >      raise ValueError("sorry, you lose") >  > >  > Cheers, >  > Xav > > but nobody commented. > > Colin W. Colin: Sure, you can do it that way. IMO, though, the OP was wrong, and so is the PEP. Source code is meant to communicate. So it must transmit the correct information to the computer; it also must inform your coworkers. That means that you have a responsibility to care what they think, though you privately have your opinions. Another reason the PEP is faulty in this circumstance is that a misplaced backslash, or a missing one, is easily found and fixed. A misplaced parentheses, or just one of a pair, will transform your source code into something which may compile and then give faulty results: a disaster. So keep it simple, and make it legible. Yours, John -- http://mail.python.org/mailman/listinfo/python-list

File Manager in Tkinter

2010-08-09 Thread John
As a learning exercise in Tkinter I htought about making a very simple and basic file manager for my own use. I tried searching google for any sample project and could not find anything. Not exactly sure how to start I tought I could ask here? I thought about making two listboxes one to list fol

Re: File Manager in Tkinter

2010-08-10 Thread John
On Tue, 10 Aug 2010 10:40:53 +0200, Eric Brunel wrote: >In article , John wrote: > >> As a learning exercise in Tkinter I htought about making a very simple >> and basic file manager for my own use. I tried searching google for >> any sample project and could not find any

Re: File Manager in Tkinter

2010-08-10 Thread John
On Tue, 10 Aug 2010 09:20:31 -0700 (PDT), Jeff Hobbs wrote: >On Aug 9, 9:53 pm, John wrote: >> As a learning exercise in Tkinter I htought about making a very simple >> and basic file manager for my own use. I tried searching google for >> any sample project and could n

Re: File Manager in Tkinter

2010-08-10 Thread John
On Tue, 10 Aug 2010 14:51:14 -0700 (PDT), Jeff Hobbs wrote: >On Aug 10, 9:43 am, John wrote: >> On Tue, 10 Aug 2010 09:20:31 -0700 (PDT), Jeff  Hobbs >> >> >> >> wrote: >> >On Aug 9, 9:53 pm, John wrote: >> >> As a learning exercise in

Re: Where are python module installed?

2009-09-20 Thread John
ood info in the top-level Python README file distributed with the source. After you run `./configure --prefix=/foo/bar/baz`, have a look inside the generated Makefile (look for `${prefix}`). You might also take a peek into the config.log file that gets created. ---John -- http://mail.python.org/mailman/listinfo/python-list

Re: Why __slots__ slows down attribute access?

2011-08-23 Thread John-John Tedro
0.219 usec per loop (regular) = 100 loops, best of 3: 0.231 usec per loop Python 2.7.2 (slots) = 100 loops, best of 3: 0.244 usec per loop (regular) = 100 loops, best of 3: 0.285 usec per loop Python 3.2 (slots) = 100 loops, best of 3: 0.193 usec per loop (regular) = 100 loops, best of 3: 0.224 usec per loop -- John-John Tedro -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I automate the removal of all non-ascii characters from my code?

2011-09-12 Thread John-John Tedro
st.txt #> file test.txt test.txt: UTF-8 Unicode text #> iconv test.txt -f utf-8 -t latin1 > test.l1.txt #> file test.l1.txt test.l1.txt: ISO-8859 text Note: I use latin1 (iso-8859-1) because it can describe the characters 'å', 'ä', 'ö'. Your encoding might be different depending on what system you are using. The gist is that if you specify the correct encoding as mentioned above with the "coding"-comment, your program will probably (ish) run as intended. -- John-John Tedro -- http://mail.python.org/mailman/listinfo/python-list

Re: Turkic I and re

2011-09-15 Thread John-John Tedro
makes "\w, \W, \b, \B, \s and \S dependent on the current locale". Which probably does not yield to the special rules mentioned above, but I could be wrong. Make sure that your locale is correct and test again. If you are unsuccessful, I don't see a 'Turkic flag' being introduced into re module any time soon, given the following from PEP 20 "Special cases aren't special enough to break the rules" Cheers, -- John-John Tedro -- http://mail.python.org/mailman/listinfo/python-list

Fwd: Turkic I and re

2011-09-16 Thread John-John Tedro
even > > -- > http://mail.python.org/mailman/listinfo/python-list > Yeah, it's more probable that language conventions and functions grow around characters that look right. No one except developers care what specific codepoint they have, so soon you would have a mish-mash of special rules converting between each special case. P.S. Sorry Steven, i missed clicking "reply to all". -- John-John Tedro -- http://mail.python.org/mailman/listinfo/python-list

Re: python backup script

2013-05-06 Thread John Gordon
; > > stdin=cmd1.stdout) > Thank you Enrico. I've just tried your script and got this error: > stdin=cmd1.stdout) > ^ > SyntaxError: invalid syntax Looks like you need a comma after 'stdout=filename'. -- John Gordon

Re: Get filename using filefialog.askfilename

2013-05-07 Thread John Gordon
ile) And it will display documentation for using objects of that type. You can also use this command: >>> dir(file) And it will display all the members and methods that the object provides. -- John Gordon A is for Amy, who fell down the stairs gor...

Re: Style question -- plural of class name?

2013-05-08 Thread John Downs
On Wed, May 8, 2013 at 4:20 PM, Roy Smith wrote: > FooEntry is a class. How would you describe a list of these in a > docstring? > > "A list of FooEntries" > > "A list of FooEntrys" > > "A list of FooEntry's" > > "A list of FooEntry instances" > > The first one certainly sounds the best, but it

Re: @staticmethods called more than once

2013-05-21 Thread John Gordon
y what the problem is. However, I have a guess. Does MyLogger.set_logger() contain a call to addHandler()? Each call to addHandler() adds another handler to your logger, and when you call log.critical() [or any other log function] you get one line of output for each handler. You should only cal

Re: @staticmethods called more than once

2013-05-21 Thread John Gordon
In John Gordon writes: > You should only call addHandler() once. ...for each intended logging output destination, of course. If you want logging output to appear in a file and on-screen, then you would call addHandler() once with a file handler and once with a screen handler. But I think

Re: Simple algorithm question - how to reorder a sequence economically

2013-05-24 Thread John Ladasky
On Friday, May 24, 2013 3:52:18 AM UTC-7, Steven D'Aprano wrote: > On Fri, 24 May 2013 01:14:45 -0700, Peter Brooks wrote: > > > That is, for a sequence 1,2,3,4 to produce an arbitrary ordering (eg > > 2,1,4,3) that is different each time. > > You can't *guarantee* that it will be different each

Re: Python Magazine

2013-05-25 Thread John Ladasky
On Saturday, May 25, 2013 8:30:19 AM UTC-7, Roy Smith wrote: > From my phone, I > can call any other phone anywhere in the world. But I can't talk > directly to the file server in my neighbor's house across the street? Hmmm... I've been an advocate of IPv6, but... now you've got me thinking of

Re: Simple algorithm question - how to reorder a sequence economically

2013-05-25 Thread John Ladasky
On Friday, May 24, 2013 10:33:47 AM UTC-7, Yours Truly wrote: > If you don't reshuffle p, it guarantees the maximum interval between reusing > the same permutation. Of course, that comes at a certain price. Given two permutations p[x] and p[x+1], they will ALWAYS be adjacent, in every repetition

Re: Total Beginner - Extracting Data from a Database Online (Screenshot)

2013-05-25 Thread John Ladasky
On Friday, May 24, 2013 4:36:35 PM UTC-7, Carlos Nepomuceno wrote: > #to create the tables list > tables=[[re.findall('(.*?)',r,re.S) for r in > re.findall('(.*?)',t,re.S)] for t in > re.findall('(.*?)',page,re.S)] > > > Pretty simple. Two nested list comprehensions, with regex pattern matchi

Re: Python Magazine

2013-05-25 Thread John Ladasky
A perfectly fair point, Roy. It's just when you started suggesting connecting to your neighbor's file server -- well, that's not something that many people would ordinarily do. So, my mind leaped to the possibility of uninvited connections. Related question: would denial-of-service attacks be

Re: help?? on functions

2013-05-27 Thread John Ladasky
Steven gave you a lot of good advice. Let me add just one remark. Python already has a builtin function called "input." If you define a variable with the same name as a builtin and then you try to use that builtin, you will be in for a (usually unpleasant) surprise. -- http://mail.python.org/

Re: How clean/elegant is Python's syntax?

2013-05-30 Thread John Ladasky
On Thursday, May 30, 2013 11:36:54 AM UTC-7, Ian wrote: > I don't object to changing the join method (one of the more > shoe-horned string methods) back into a function, but to my eyes > you've got the arguments backward. It should be: > > def join(sep, iterable): return sep.join(iterable) > >

Re: [RELEASED] Python 2.7.5

2013-06-03 Thread John Nagle
language, with different libraries, and lots of things that still don't work. Many old applications will never be converted. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: Beginner question

2013-06-04 Thread John Ladasky
On Monday, June 3, 2013 11:46:03 PM UTC-7, Carlos Nepomuceno wrote: > That doesn't even works because input() is the same as eval(raw_input()). So > you'll get a NameError exception. > > I think you know that. Perhaps you mean raw_input() instead of input(). But the OP's code shows print() funct

Re: Beginner question

2013-06-04 Thread John Ladasky
On Tuesday, June 4, 2013 12:45:38 AM UTC-7, Anssi Saari wrote: > BTW, did I get the logic correctly, the end result is random? You're right! I'm guessing that's not what the OP wants? -- http://mail.python.org/mailman/listinfo/python-list

Re: lstrip problem - beginner question

2013-06-04 Thread John Gordon
x27;re telling python to remove all of the characters in '>contig-100_' from the base string, which leaves nothing remaining. The reason it "worked" on your first example was that the character '1' didn't occur in your sample header string 'scaffold_

Re: How to increment date by week?

2013-06-04 Thread John Gordon
=7) print "%d. %s" % (n, the_date) -- 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: Errin when executing a cgi script that sets a cookie in the browser

2013-06-05 Thread John Gordon
x27;No such file or directory' or 'Command not found' error if they begin with a shebang line which refers to a nonexistent program. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

My son wants me to teach him Python

2013-06-12 Thread John Ladasky
Hi folks, My son is 17 years old. He just took a one-year course in web page design at his high school. HTML is worth knowing, I suppose, and I think he has also done a little Javascript. He has expressed an interest in eventually wanting to program 3D video games. For that purpose, HTML

Re: My son wants me to teach him Python

2013-06-12 Thread John Ladasky
On Wednesday, June 12, 2013 8:02:46 PM UTC, Chris Angelico wrote: > [1] http://www.greenteapress.com/thinkpython/ I think, but DNS on this > computer is broken at the moment so I can't verify that link Your link is correct, thank you! -- http://mail.python.org/mailman/listinfo/python-list

Re: My son wants me to teach him Python

2013-06-12 Thread John Ladasky
On Wednesday, June 12, 2013 8:34:15 PM UTC, Chris Angelico wrote: >Unless you have a good reason for sticking with 2.x, go with 3.x. I agree, Chris, I will be teaching my son Python 3 from the start. In fact, I'm in the middle of a messy upgrade of my own computer to get everything ready for Py

Re: Having a hard time to 'get' bing api search results

2013-06-13 Thread John Gordon
n't matter to me. Thoughts? It looks like the code is mistakenly interpreting 'user:A' as a port specifier instead of a username and password. Can you supply the credentials another way, perhaps in a header? -- John Gordon A is for Amy, who fell down th

Re: Newbie: The philosophy behind list indexes

2013-06-15 Thread John Ladasky
On Friday, June 14, 2013 10:21:28 PM UTC-7, ian.l@gmail.com wrote: >I'm sure there's a good reason, but I'm worried it will result in a lot of >'one-off' errors for me, so I need to get my head around the philosophy of this >behaviour, and where else it is observed (or not observed.) My under

Imports (in Py3), please help a novice

2013-06-15 Thread John Ladasky
from distutils.core import setup setup(name = "foo", version = "1.0", author = "John", py_modules = ["foo"]) ## As long as all the names I want to import are defined in foo.py, which is located in the same folder as my setup.py, this works. I can execute "i

Re: Imports (in Py3), please help a novice

2013-06-15 Thread John Ladasky
Followup to my own post: I am sticking pretty closely to this example from Mike Driscoll which, admittedly, is based on Python 2.6: http://www.blog.pythonlibrary.org/2012/07/08/python-201-creating-modules-and-packages/ I'm trying to do this one step at a time. First try a local import, then i

Re: Imports (in Py3), please help a novice

2013-06-16 Thread John Ladasky
Thanks for your reply, Miki. On Sunday, June 16, 2013 7:50:53 AM UTC-7, Miki Tebeka wrote: > > Is there an import / distutils tutorial out there? I'm looking for it, but > > perhaps one of you already knows where to find it. Thanks! > > Did you have a look at http://docs.python.org/3.3/distuti

Re: Natural Language Processing with Python .dispersion_plot returns nothing

2013-06-17 Thread John Gordon
last line I typed. How long did you wait for results before interrupting the command? How large is text4? It might just take a while to process. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for B

Re: Updating a filename's counter value failed each time

2013-06-17 Thread John Gordon
y. There are no results to be fetched. If you want to get results, execute a query (usually a SELECT.) Also, that print statement is an obvious syntax error. Please post the actual code you're running; don't type it in from memory. -- John Gordon A is for Amy, who fell dow

Re: Updating a filename's counter value failed each time

2013-06-17 Thread John Gordon
thing, so you will at least know if the UPDATE statement is ever executed. Print the cur.rowcount attribute, which contains the number of rows that were affected by the update. If it's zero, that should tell you something. -- John Gordon A is for Amy, who fell down the s

Re: Updating a filename's counter value failed each time

2013-06-17 Thread John Gordon
eplase > if cur.rowcount: > print( " database has been affected" ) > with print cur.rowcount() rowcount isn't a method call; it's just an attribute. You don't need the parentheses. -- John Gordon A is for Amy, who fell down the st

Re: Problem with the "for" loop syntax

2013-06-19 Thread John Gordon
you sure that's a real blank space, and not some weird character that *looks* like a space? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The

Re: n00b question on spacing

2013-06-21 Thread John Gordon
ase %s/%s" > %(settings['MONGODB_DB'], settings['MONGODB_COLLECTION']), > level=log.DEBUG, spider=spider) > Is this ok? Are there any rules in Python when it comes to breaking up > long lines of code? There are guidelines in the PEP8 document:

Re: How can i fix this?

2013-06-22 Thread John Gordon
print "Hello Master!" > > break > > > else: print "error" > this doesent help me at all Then you'll have to explain why, exactly, it doesn't help. Simply saying "this doesn't help me" is very unhelpfu

Re: Loop Question

2013-06-24 Thread John Gordon
hile statement belong? while True: username = raw_input("Please enter your username: ") password = raw_input("Please enter your password: ") if username == "john doe" and password == "fopwpo": print "Login Successful&q

Re: Loop Question

2013-06-24 Thread John Gordon
In =?UTF-8?B?Q2hyaXMg4oCcS3dwb2xza2HigJ0gV2Fycmljaw==?= writes: > > while True: > > username = raw_input("Please enter your username: ") > > password = raw_input("Please enter your password: ") > > > > if username == "john

Re: What's wrong with this code? (UnboundLocalError: local variable referenced before assignment)

2013-06-24 Thread John Gordon
cky to explain, but I'll do my best. :-) The problem is that change() isn't being executed here; instead it's being executed from within root.mainloop(), whenever the user presses button-1. And within root.mainloop(), there is no variable called isWhite. -- John Gordon

Re: What's wrong with this code? (UnboundLocalError: local variable referenced before assignment)

2013-06-24 Thread John Gordon
se global or nonlocal > declarations. Quite right. I should have verified my answer before posting. Thanks for setting me straight. :-) -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

warnings filters for varying message

2013-06-27 Thread John Reid
n xrange(2): warnings.warn('Warning message') # This prints 1 warning warnings.warn("Warning %d" % i) # This prints 2 warnings What do I need to do to get the warnings module just to print one warning for the second warnings.warn line? Thanks, John. -- http://mail.python.org/mailman/listinfo/python-list

Homework help requested (not what you think!)

2013-07-16 Thread John Ladasky
Hi folks, No, I'm not asking for YOU to help ME with a Python homework assignment! Previously, I mentioned that I was starting to teach my son Python. https://groups.google.com/d/msg/comp.lang.python/I7spp6iC3tw/8lxUXfrL-9gJ He just took a course at his high school called Web Technology and D

Re: Python HTTP POST

2013-07-17 Thread John Gordon
the google form search input box is named 'q' data = { 'q': 'Pie' } response = urllib2.urlopen('http://google.com', urllib.urlencode(data)) print response.read() -- John Gordon A is for Amy, who fell down the stairs go

Re: Find and Replace Simplification

2013-07-19 Thread John Gordon
x27;,', '', 'DATA') > DATA = re.sub('\'', '', 'DATA') > DATA = re.sub('(', '', 'DATA') > DATA = re.sub(')', '', 'DATA') If your actual use-case is this simple, you might w

Homework help requested, thanks to everyone.

2013-07-21 Thread John Ladasky
Thanks to everyone for their wealth of suggestions. I already had my students playing with turtle. And I had asked them to alphabetize a string (without having previously revealed the sorted() function). So far, I have taken up the suggestion of the number-guessing game. One of my students h

PyGLet on Python 3

2013-07-22 Thread John Ladasky
On 07/21/2013 08:10 PM, Joseph Clark wrote: > John, have you taken a look at pyglet? It's an alternative to pygame and I > found it pretty slick once I got the hang of it. There is a development > version that's compatible with python 3 and I've never had a bug with

Python3, GUIs, game APIs, PyGLet, 2to3...?

2013-07-24 Thread John Ladasky
I am teaching Python 3 to a few beginning computer programming students. Being high-school age boys, they are, unsurprisingly, interested in games. I want to introduce them to real-time programming and GUI in the most painless way possible. I know that Python comes bundled with Tkinter. Asid

Re: Python3, GUIs, game APIs, PyGLet, 2to3...?

2013-07-25 Thread John Ladasky
Followup to my own post: I've made progress with PyGLet. I should mention that I'm using Ubuntu Linux 13.04 64-bit, in case it matters. I tried executing "2to3 -w *.py" on just the files in the directory pyglet-1.2alpha1/pyglet. I then changed back to the pyglet-1.2alpha1 directory, and execu

Re: Python3, GUIs, game APIs, PyGLet, 2to3...?

2013-07-25 Thread John Ladasky
On Thursday, July 25, 2013 1:35:43 AM UTC-7, Kushal Kumaran wrote: > Does your python command mean python2 or python3? The setup.py at > https://code.google.com/p/pyglet/source/browse/setup.py seems to run > 2to3 automatically, but that will only happen if you actually use > python3 to run setup.

Re: PyGLet on Python 3

2013-07-25 Thread John Ladasky
Hi Devyn. After I didn't get a response concerning PyGLet inside this thread, I started another thread. It's here: https://groups.google.com/forum/#!topic/comp.lang.python/ARtI0GC9RHc -- http://mail.python.org/mailman/listinfo/python-list

PyGLet, 2to3...?

2013-07-25 Thread John Ladasky
On Thursday, July 25, 2013 3:26:01 PM UTC-7, John Ladasky wrote: > I'll try again from scratch, and see whether that clears up my problems. Nope, that didn't work. === john@john:~/Desktop/pyglet-1.2alpha1$ sudo python3 setup.py install [sudo]

How would I do this?

2013-07-25 Thread John Doe
Hey guys, I;m working on making a chess program and I hit a wall. I have no idea how to get the position of the chess pieces. I have the chess board 1-8 and A-H for black as well as 1-8 and a-h for white. i just have to figure out how to declare those positions for the actual pieces so like the

Re: Newbie: Python 3 and web applications?

2013-07-26 Thread John Gordon
o learn, but frameworks handle a ton of low-level details for you and make web development overall much easier. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears --

Re: embedded python and threading

2013-07-26 Thread John Gordon
;", line 6, in main > 9: AttributeError: 'builtin_function_or_method' object has no attribute > 'sleep' > == You must have a file named 'time.py' in the current directory, and the import statement is getting that module instead of the

Re: dump a multi dimensional dictionary

2013-07-26 Thread John Gordon
> {'3': ('1', '2')} > or should I just write my own dump function that can hanle thiS? I think you have the arguments to pickle.dump() in the wrong order. The data to be dumped should come first, then the file object. -- 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: PyGLet, 2to3...?

2013-07-26 Thread John Ladasky
On Thursday, July 25, 2013 4:49:16 PM UTC-7, John Ladasky wrote: > On Thursday, July 25, 2013 3:26:01 PM UTC-7, John Ladasky wrote: > > > I'll try again from scratch, and see whether that clears up my problems. > > Nope, that didn't work. Thanks to both Jerry and Ku

Re: PyGLet, 2to3...?

2013-07-26 Thread John Ladasky
I'm making progress, but I'm not out of the woods yet. I'm trying to run some of the programs from the tutorial web pages, and from the pyglet1.2alpha1/examples directory. I've realized that I will probably need to run 2to3 on the many of the latter. The Hello, World example runs. http://ww

Re: PyGLet, 2to3...?

2013-07-26 Thread John Ladasky
On Friday, July 26, 2013 6:19:48 PM UTC-7, John Ladasky wrote: > I'm making progress, but I'm not out of the woods yet. And while I appreciate any comments that may appear here, I've just found the pyglet-users group... https://groups.google.com/forum/#!forum/pyglet-users ...

Re: PEP8 79 char max

2013-07-29 Thread John Gordon
screen sizes. And even if you're on a device that can display more than 80 characters, it can be convenient to have several windows display side-to-side. > Would following this recommendation improve script performance? No, but it improves human readability. -- John Gordon

Pyglet on Python3.x, problems

2013-07-29 Thread John Ladasky
Hi folks, For whatever reason, the pyglet package is getting a lot of attention on c.l.python these past few days. I am guilty of generating some of that potentially off-topic conversation myself. At the end of my last thread, I reported that I had found the pyglet-users newsgroup, and would

Re: Pyglet on Python3.x, problems

2013-07-29 Thread John Ladasky
Thanks for your reply, Joshua. >From the interpreter, I too can import pyglet, instantiate a >pyglet.window.Window, and have it pop up (although, following your directions, >now I can't CLOSE it because you didn't assign a name to it! :^]). I can get >all the help information as well. It look

Re: Pyglet on Python3.x, problems

2013-07-29 Thread John Ladasky
G. Ian, thank you, you gave me a clue. I thought I was being careful about avoiding local imports. I just removed the tests directory from inside the pyglet-1.2alpha1 directory and tried running it from its new location. That got rid of the error message which was displaying uncorrected

Re: binary key in dictionary

2013-07-31 Thread John Gordon
to it. This requires that tmpgndict[binmac] already exists, which it does not. Make sure that tmpgndict[binmac] exists before you try appending to it. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: script to Login a website

2013-07-31 Thread John Gordon
e contents of each file, be aware that the newlines at the end of each line are included. If you don't want these, be sure to call the rstrip() method to remove traling whitespace. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is f

Generator vs functools.partial?

2012-06-21 Thread John O'Hagan
se it encapsulates the calculation of the arguments inside the function that is using them without repeating it, and there are no restrictions on argument order like partial. But sending None is annoying. :) Old news? Thoughts, criticisms, theories? -- John -- http://mail.python.org/mailman/lis

Re: Generator vs functools.partial?

2012-06-21 Thread John O'Hagan
On 21 Jun 2012 12:19:20 GMT Steven D'Aprano wrote: > On Thu, 21 Jun 2012 21:25:04 +1000, John O'Hagan wrote: > > > Sometimes a function gets called repeatedly with the same expensive > > argument: > > > > def some_func(arg, i): > > (do_s

Re: Generator vs functools.partial?

2012-06-21 Thread John O'Hagan
On Thu, 21 Jun 2012 14:20:23 +0200 Thomas Rachel wrote: > Am 21.06.2012 13:25 schrieb John O'Hagan: > > > But what about a generator? > > Yes, but... > > > def some_func(): > > arg = big_calculation() > > while 1: > > i

Re: how to compare below 2 json structure in python

2012-06-21 Thread John Gordon
2 >} > } Assuming you have valid json strings (which these aren't), I think you could convert them into python objects with json.loads() and then compare the python objects. For example: >>> import json >>> json1 = '{"color": "blue", &qu

Re: Why has python3 been created as a seperate language where there is still python2.7 ?

2012-06-26 Thread John Nagle
st has some users. OurSQL has a different API than MySQLdb, and isn't quite ready for prime time yet. That's why I'm still on Python 2.7. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: PySerial could not open port COM4: [Error 5] Access is denied - please help

2012-06-26 Thread John Nagle
e four serial ports. Is some device emulating a serial port? John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: code review

2012-07-01 Thread John O'Hagan
[...] +1 I've only ever known Python (well, I've almost forgotten Bash), and when I first needed a range test, I guessed at the above form and was pleasantly surprised that it worked: it seemed too good to be true that Python was smart enough to know I wanted the same "x" to be a

Re: when "normal" parallel computations in CPython will be implemented at last?

2012-07-02 Thread John Nagle
ct only at well-defined points. That's un-Pythonic. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: code review

2012-07-02 Thread John O'Hagan
ic is another field which could do with a "metrification": I get tired of explaining to beginners why there's no B#, except when it's C. Check out http://musicnotation.org If legacy systems get too far out of sync with current practice, they become an unnecessary layer of complexity and a hurdle to understanding, and at some point you have to take the plunge, old books be damned. -- John -- http://mail.python.org/mailman/listinfo/python-list

Re: code review

2012-07-03 Thread John O'Hagan
On Mon, 2 Jul 2012 22:10:00 -0700 (PDT) rusi wrote: > On Jul 3, 7:25 am, John O'Hagan wrote: > > > > I agree to some extent, but as a counter-example, when I was a child there > > a subject called "Weights and Measures" which is now redundant because of

Re: code review

2012-07-03 Thread John Gordon
e if the (encrypted) password is stored in a database, you can't exceed the table column width. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The

Re: simpler increment of time values?

2012-07-05 Thread John Nagle
. Adding a datetime.time to a datetime.timedelta isn't that useful. It would have to return a value error if the result crossed a day boundary. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Apology for OT posts (was: code review)

2012-07-05 Thread John O'Hagan
ain > for the feedback. > As one of the perpetrators, I did apologise for being OT within the body of my replies to OT posts, but I see the irony. I guess I just thought somebody else would do it eventually. I hereby apologise for not taking the correct action, and vow to do so in future: to change the subject line regardless of who initially went OT, starting now. Regards, -- John -- http://mail.python.org/mailman/listinfo/python-list

select module missing/corrupt

2012-07-07 Thread John Pote
ss imports OK. Anyone know why the version 2.6 select .so file should be renamed select_failed.so and so not able to be imported? Of interest the 3.1 installation also has the select module file re-named select_failed.so. Any help appreciated, Regards, John Pote --- Poste

Re: Socket code not executing properly in a thread (Windows)

2012-07-07 Thread John Nagle
the last one. Google Voice isn't a very good SMS gateway. I used to use it, but switched to Twilio (which costs, but works) two years ago. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: How to safely maintain a status file

2012-07-09 Thread John Nagle
all the crawler processes lose their database connections, abort, and are restarted. This allows multiple servers to coordinate through one database. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: Adding to a List and displaying quantity in the list

2012-07-10 Thread John Gordon
earlier code it appears to be a function, but here you're appending it to leavelist. Did you really mean to append a function object to leavelist? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: lambda in list comprehension acting funny

2012-07-11 Thread John Ladasky
Exactly. It's threads like these which remind me why I never use lambda. I would rather give a function an explicit name and adhere to the familiar Python syntax, despite the two extra lines of code. I don't even like the name "lambda". It doesn't tell you what

Re: lambda in list comprehension acting funny

2012-07-11 Thread John O'Hagan
On Wed, 11 Jul 2012 13:21:34 -0700 (PDT) John Ladasky wrote: > Exactly. It's threads like these which remind me why I never use lambda. I > would rather give a function an explicit name and adhere to the familiar > Python syntax, despite the two extra lines of code. I don&#

Re: adding a simulation mode

2012-07-12 Thread John Gordon
en(['notfouhd'], shell=True) > copytree('sjkdf', 'dsflkj') > except Exception as e: > print("here") > because if copytree fails it quits anyway. > I also looked at the code but can't quite get why.. any idea? copytree() coul

Re: adding a simulation mode

2012-07-12 Thread John Gordon
In andrea crotti writes: > Well that's what I thought, but I can't find any explicit exit > anywhere in shutil, so what's going on there? Try catching SystemExit specifically (it doesn't inherit from Exception, so "except Exception" won't catch it.) -

<    1   2   3   4   5   6   7   8   9   10   >