Re: Target WSGI script cannot be loaded as Python module.

2018-05-23 Thread John Gordon
led successfully. Is your web server using Python 2 or Python 3 to execute WSGI? -- 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&quo

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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: Python3 using requests to grab HTTP Auth Data

2017-02-01 Thread John Gordon
e interactive, you could require that the user supply a file in the current directory containing the username and password. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edw

Re: Using python to start programs after logging in

2017-01-20 Thread John Gordon
hen all > programs will be started on the same virtual desktop and I want to > start them on different ones. The window manager doesn't allow you to specify a target desktop? That seems like a pretty heinous feature omission. -- John Gordon A is for Amy, who fell down the s

Re: Using python to start programs after logging in

2017-01-19 Thread John Gordon
lt-in facilities for starting programs would be better. Why are you using Python instead? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashl

Re: OT - "Soft" ESC key on the new MacBook Pro

2016-12-14 Thread John Gordon
In Gregory Ewing writes: > Once you're in the clutches of Apple, there is no Escape. Ha! -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "Th

Re: Install Problem

2016-12-13 Thread John Gordon
Python. How can this problem be fixed? When does the error occur? During installation? Or after installation when you're trying to run a python program? What version of Windows do you have? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B

Re: The right way to 'call' a class attribute inside the same class

2016-12-12 Thread John Gordon
ever one you prefer. self.class_attr may be more convenient because you don't have to provide a specific class name. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey,

Re: calling a program from Python batch file

2016-12-07 Thread John Gordon
responding to expected patterns in their output. Pexpect allows your script to spawn a child application and control it as if a human were typing commands. https://pexpect.readthedocs.io/en/stable/ -- John Gordon A is for Amy, who fell down the stairs gor...@pa

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread John Gordon
ERROR No file named '$HOME/file.txt' vi $(grep -l foo *.txt) ERROR No file named '$(grep -l foo *.txt)' None of these commands would work if bash didn't "alter the input going to another program". -- John Gordon A is for Amy, who fell

Re: Error In querying Genderize.io. Can someone please help

2016-12-01 Thread John Gordon
(r.content) You're using http: instead of https:, and you're using ?katty instead of ?name=katty, and therefore the host does not recognize your request as an API call and redirects you to the normal webpage. -- John Gordon A is for Amy, who fell down the

Re: Can json.dumps create multiple lines

2016-12-01 Thread John Gordon
", > "with several strings", > "as a demo" > ]' json.dumps() has an 'indent' keyword argument, but I believe it only enables indenting of each whole element, not individual members of a list. Perhaps somet

Re: Python while loop

2016-11-30 Thread John Gordon
name; you could have called it "hamburger" and python would treat it just the same. -- 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: MemoryError and Pickle

2016-11-21 Thread John Gordon
oesn't use pickle format, so your reader program would have to be modified to read this format. And you'll run into the same problem if the reader expects to keep all the data in memory. -- John Gordon A is for Amy, who fell down the st

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

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'] -

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

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: 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: 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: 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: 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: 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: xml parsing with lxml

2016-10-07 Thread John Gordon
In <622ea3b0-88b4-420b-89e0-9e7c6e866...@googlegroups.com> Doug OLeary writes: > >>> from lxml import etree > >>> doc =3D etree.parse('config.xml') > Now what? For instance, how do I list the top level children of > ? root = doc.getroot() for

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: 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: 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: 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: 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: 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: 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: 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: 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: JSON result parsing

2016-07-29 Thread John Gordon
return results['ID'] else: return 'something else' -- 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 Tin

Re: what the heck this code is doing?

2016-07-01 Thread John Gordon
27;?? It loops through the child items in entry, looking for one with a 'key' value of 'Track ID'. If it finds one, it sets found=True and loops one more time, returning the text of the *next* child element. It depends on the 'key' element being directly followed by the &#

Re: Break and Continue: While Loops

2016-06-23 Thread John Gordon
ode prints i and THEN adds one to it. So i is 4, it gets printed, then 1 is added to it, so it becomes 5 and then the loop exits. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: while Loops

2016-06-22 Thread John Gordon
ing at 5, and only stop when i is 6. -- 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 for loop append a list [] when using parallel programming

2016-06-15 Thread John Gordon
In meInvent bbird writes: > how to for loop append a list [] when using parallel programming items = [] for item in parallelized_object_factory(): items.append(item) If you want a more specific answer, ask a more specific question. -- John Gordon A is

Re: log file.

2016-06-14 Thread John Gordon
g for help with logging, or communicating with the pump? -- 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.py

Re: how to solve memory

2016-06-10 Thread John Gordon
ur name changed in previous post? My comment was that the recursive calls weren't indented in the "if deep > 0" block, therefore DFS was being called infinitely with smaller and smaller values of deep. But it appears you have fixed that issue. -- John Gordon

Re: how to solve memory

2016-06-10 Thread John Gordon
In <4f853aa2-cc00-480b-9fd7-79b05cbd4...@googlegroups.com> meInvent bbird writes: > https://drive.google.com/file/d/0Bxs_ao6uuBDULVNsRjZSVjdPYlE/view?usp=sharing I already responded to your earlier post about this program. Did you read it? -- John Gordon A is for

Re: why it is like stop running after a 3 seconds

2016-06-09 Thread John Gordon
he function, but the recursive calls aren't inside that if block. DFS keeps calling itself with smaller and smaller values of deep. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: Unit test a class with xml elements

2016-05-24 Thread John Gordon
here. > Share if any examples available. Create your own sample XML illustrating each desired combination. Then write test cases for each. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for B

Re: ZipImportError: can't find module

2016-05-24 Thread John Gordon
ob? Are the permissions on the zipfile correct, and all parent directories? How, specifically, are you importing the module? Are you doing something like this: zipfile = zipimport.zipimporter('file.zip') zipfile.load_module('mymodule') -- John Gordon

Re: Program prints questions for user input, but won't show the answer output

2016-05-18 Thread John Gordon
ounter < 7: > if (pints[counter] < lowPints): > lowPints = pints[counter] > counter = counter + 1 > return lowPints And getLow() has a very similar problem. I suspect you want to unindent the 'counter = counter + 1' statement so that it is NOT insid

Re: Python 3.5.1 Not Working

2016-05-13 Thread John Gordon
ion 3.4.3 if you are using Windows XP. -- 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: Simplest way to locate a string in a column and get the value on the same row in another column

2016-04-28 Thread John Gordon
ething else? -- 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: Python path and append

2016-04-25 Thread John Gordon
en rename it afterwards, instead of rewriting the original file. import os f_in = open('win.txt', 'r') f_out = open('win_new.txt', 'w') for line in f_in.read().splitlines(): f_out.write(line + " *\n") f_in.close() f_

Re: Pyscripter Issues

2016-03-31 Thread John Gordon
bit version. -- 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: Not downloading

2016-03-23 Thread John Gordon
P, try using an older 3.4 version of 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" -- https://mail.python.org/mailman/listinfo/python-list

Re: from a module return a class

2016-03-19 Thread John Gordon
It has to be a function or a class. -- 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: from a module return a class

2016-03-19 Thread John Gordon
taxError: 'return' outside function Show us the complete definition of promptUser_PWord(). -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "Th

Re: from a module return a class

2016-03-18 Thread John Gordon
en't callable. promptUser_PWord() has to be a function or a class. -- 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" -- htt

Re: from a module return a class

2016-03-18 Thread John Gordon
; > callable. promptUser_PWord() has to be a function or a class. > > > Yes, but I guess the OP's program will run into the SyntaxError when > trying to import the module, i.e., before it ever encounters the > TypeError: 'module' object is not callable. Good poi

Re: password and username code

2016-03-06 Thread John Gordon
inding out if a name is registered? There are lots of possible ways to do it. Do you have one 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, "Th

Re: list reversal error

2016-03-03 Thread John Gordon
valuates to j = len(data) which would yield 5 for a five-element list, but the last actual element is in data[4]. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears --

Re: Continuing indentation

2016-03-03 Thread John Gordon
In <871t7sbkex@elektro.pacujo.net> Marko Rauhamaa writes: > Ethan Furman : > > No, it isn't. Using '\' for line continuation is strongly discouraged. > Why would you discourage valid syntax? Some things that are permissible may not be desirable. -- J

Re: importing: what does "from" do?

2016-01-21 Thread John Gordon
You shouldn't have to rewrite any of the actual code. -- 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: importing: what does "from" do?

2016-01-21 Thread John Gordon
contain > > something named 'hexdump'? > Yes In that case, the problem is most likely a circular import issue, as you mentioned. The only way to fix it is to reorganize your modules. How did this error come up? Did the code work previously? If so, what changed? -- Jo

Re: importing: what does "from" do?

2016-01-21 Thread John Gordon
#x27;utilities' module? Does it, in fact, contain something named 'hexdump'? -- 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

Re: Question about a class member

2016-01-07 Thread John Gordon
transmat_ = transmat > model.means_ = means > model.covars_ = covars > # Generate samples > X, Z = model.sample(50) > - sample() is a method in the GaussianHMM class. (In this case, it's a method in the _BaseHMM class, from which GaussianHMM inherits.) -- John Gord

Re: imshow keeps crashhing

2016-01-06 Thread John Gordon
it even show up as a choice? Is there something special about the /private directory? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrum

Re: imshow keeps crashhing

2016-01-06 Thread John Gordon
Do you have any > suggestions? I don't really know much about Macs... Can you run Preview and open the temporary file successfully? When launched from scipy, Does Preview run as a user other than yourself? What are the permissions on the temporary file when it's originally create

Re: Why is there difference between cmd line and .py file?

2016-01-05 Thread John Gordon
> IndexError: invalid index to scalar variable. > // The built-in function sum() returns a single value, not a list, so this is a reasonable error. I suspect the code actually intended to call numpy.sum(), which does return a list (or something like a list). -- John Gordon

Re: imshow keeps crashhing

2015-12-22 Thread John Gordon
ble SCIPY_PIL_IMAGE_VIEWER. If that variable is not present, it uses 'see' by default. Do you have a suitable image viewing program installed on your computer? If so, try setting the SCIPY_PIL_IMAGE_VIEWER environment variable to the name of that program. -- John Gordon

Re: error reading api with urllib

2015-12-16 Thread John Gordon
your Request object. Try doing that. (It works in your browser because it defaults to GET automatically.) -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, &qu

Re: Is vars() the most useless Python built-in ever?

2015-12-01 Thread John Gordon
re is almost always *MANY* ways to > achieve the same output.=20 The koan reads: There should be one-- and preferably only one --obvious way to do it. You left out the rather important word "obvious". -- John Gordon A is for Amy, who fell down the stairs gor...

Re: if else python

2015-11-26 Thread John Gordon
e in a loop, so perhaps you're seeing the 'if' branch on one loop iteration, anf the 'else' branch on the next iteration? I see that your if and else branches both contain a screen.addstr() call. Are you seeing both of these outputs? -- John Gordon A is fo

Re: Finding scores from a list

2015-11-24 Thread John Gordon
back (most recent call last): > File "", line 1, in > print((results["gengyang"])["score"]) > TypeError: list indices must be integers, not str Lists are indexed by number, not by name. You want something like this: for result in results:

Re: anyone tell me why my program will not run?

2015-11-22 Thread John Gordon
u meant to have this piece of code indented under the while loop above? -- 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: What is a function parameter =[] for?

2015-11-18 Thread John Gordon
. > Could you explain a little to me? > Thanks, > def eList(val, list0=[]): > list0.append(val) > return list0 > list1 = eList(12) > list1 = eList('a') That is a default parameter. If eList() is called without an argument for list0, it will use [] as the defa

Re: Is there any reason to introduce this intermediate variable (sz)?

2015-11-17 Thread John Gordon
e contents of the tuple were ever to change, it would be much easier to simply change it in once place (the definition of sz), rather than having to edit several different occurrences of (n_iter,) in your code. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.co

Re: Is there any reason to introduce this intermediate variable (sz)?

2015-11-17 Thread John Gordon
x27;t specifically need a sequence. Is the same true for the 'size' keyword argument of np.random.normal()? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Go

Re: Is it useful for re.M in this example?

2015-11-12 Thread John Gordon
not contain newline characters. If it did, you would see the effect of re.M. -- 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: Why does 'as' not recognized?

2015-11-12 Thread John Gordon
' > >>> as=cats[2] > SyntaxError: invalid syntax > >>> as=cats > SyntaxError: invalid syntax > >>> as > SyntaxError: invalid syntax 'as' is a python language keyword, and cannot be used for variable names. -- John Gordon

Re: new to python, help please !!

2015-11-11 Thread John Gordon
when i gets incremented, but it doesn't work like that. When you increment i, you also have to reassign s1 and s2. -- 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 handle exceptions properly in a pythonic way?

2015-11-02 Thread John Gordon
at can arise during execution of the > requests.get(url)? The best way is probably to do nothing at all, and let the caller handle any exceptions. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: If one IF is satisfied, skip the rest in the nest...

2015-10-21 Thread John Gordon
ke all three of your if statements start out with this condition: if wb1_sheet1.cell(row=cell + 1, column=2).value == 0 and wb1_sheet1.cell(row=cell + 1, column=3).value == 0 So you could reorganize your code by putting an if statement at the top that only checks this condition. Then, indented under

Re: Trouble running

2015-10-06 Thread John Gordon
u using to try to save? Is it a text editor? What happens when you try to save? How do you know it didn't work? Do you get an error message? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: Check if a given value is out of certain range

2015-10-01 Thread John Gordon
;. In my opinion, when comparing a variable to a constant, it's more natural to have the variable on the left and the constant on the right, so that's one strike against this code. Another strike is that the code isn't consistent with itself; it puts the variable on the left in t

Re: Check if a given value is out of certain range

2015-10-01 Thread John Gordon
ept of "not"? I wasn't commenting directly to the "ask not..." quote; I was referring upthread to the choice between not 0 <= x <= 10 and x < 0 or x > 10 Both are of course understandable, but in my opinion, the latter one takes slightly less effort to gro

Re: Check if a given value is out of certain range

2015-10-01 Thread John Gordon
at, I don't believe that you cannot figure out how to Certainly we can understand it. But it takes ever-so-slightly more effort to do so. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: Check if a given value is out of certain range

2015-09-30 Thread John Gordon
In alister writes: > I would stick with the OP's current solution > Readability Counts! I agree. 'if x < 0 or x > 10' is perfectly fine. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is fo

Re: Question re class variable

2015-09-29 Thread John Gordon
is created, the ID of those two objects can be the same. -- 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://ma

Re: Django (Python Web Framework) Tutorial

2015-09-26 Thread John Gordon
this directory" ? Django is a web application framework. So, you have to use it together with a web server. The "document root" is the directory where the web server expects to find files to be served as web pages. You said you put the Django project code in a subdirectory of your ho

Re: Learning Modules, Arguments, Parameters (imma noob)

2015-09-24 Thread John Gordon
at variable as an argument to convert_kilo. The updated code would look like this: def main(): kilo = get_input() convert_kilo(kilo) def get_input(): kilo = float(input('Enter Kilometers: ')) return kilo def convert_kilo(kilo): miles = float(kilo * 0.6214) print( k

Re: Problem configuring apache to run python cgi on Ubuntu 14.04

2015-09-21 Thread John Gordon
may not be your problem, as you haven't told us exactly what is going 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 Ti

  1   2   3   4   5   >