On 3/19/2015 4:23 AM, Chris Kavanagh wrote:
On Wednesday, March 18, 2015 at 5:37:53 PM UTC-4, Terry Reedy wrote:
You comment out apparently irrelevant lines and see if you still have
the same problem, and if you do, delete. Repeat until you have a
Minimal Complete Verifiable Example.
Thank
On Wednesday, March 18, 2015 at 5:37:53 PM UTC-4, Terry Reedy wrote:
> On 3/18/2015 3:42 PM, Chris Kavanagh wrote:
>
> > 2nd, you say you "don't want to play guessing games", yet complain
> > about "300 lines of irrelevant code", lol. Which way is it? Do you
> > want the code, or not? How do I kno
On Wednesday, March 18, 2015 at 5:50:49 PM UTC-4, Mark Lawrence wrote:
> On 18/03/2015 19:42, Chris Kavanagh wrote:
> >
> > 2nd, you say you "don't want to play guessing games", yet complain about
> > "300 lines of irrelevant code", lol. Which way is it? Do you want the code,
> > or not? How do
On Wednesday, March 18, 2015 at 6:38:48 PM UTC-4, Steven D'Aprano wrote:
> On Thu, 19 Mar 2015 06:42 am, Chris Kavanagh wrote:
>
> > While I appreciate the help greatly I thought I had put the entire
> > traceback of the error. I was posting here and on StackOverflow, and
> > suppose I got confuse
On Thu, 19 Mar 2015 06:42 am, Chris Kavanagh wrote:
> While I appreciate the help greatly I thought I had put the entire
> traceback of the error. I was posting here and on StackOverflow, and
> suppose I got confused.
We all make mistakes. I got distracted and forgot to link you to
http://sscce
On 18/03/2015 19:42, Chris Kavanagh wrote:
2nd, you say you "don't want to play guessing games", yet complain about "300
lines of irrelevant code", lol. Which way is it? Do you want the code, or not? How do I know
what's relevant or irrelevant when I'm clearly confused? On Stack, if you don'
On 3/18/2015 3:42 PM, Chris Kavanagh wrote:
2nd, you say you "don't want to play guessing games", yet complain
about "300 lines of irrelevant code", lol. Which way is it? Do you
want the code, or not? How do I know what's relevant or irrelevant
when I'm clearly confused?
You comment out appare
On Wednesday, March 18, 2015 at 8:02:14 AM UTC-4, Steven D'Aprano wrote:
> On Wed, 18 Mar 2015 01:41 pm, Chris Kavanagh wrote:
>
> > I have a simple script that takes user input (for an Employee) such as
> > name, age, etc then puts in an sqlite3 database. The script worked fine
> > until I realiz
On Wed, 18 Mar 2015 01:41 pm, Chris Kavanagh wrote:
> I have a simple script that takes user input (for an Employee) such as
> name, age, etc then puts in an sqlite3 database. The script worked fine
> until I realized one problem. The age input field is defined in SQLAlchemy
> as an Integer, so if
On Wednesday, March 18, 2015 at 12:00:54 AM UTC-4, MRAB wrote:
> On 2015-03-18 02:41, Chris Kavanagh wrote:
> > I have a simple script that takes user input (for an Employee) such as
> > name, age, etc then puts in an sqlite3 database. The script worked fine
> > until I realized one problem. The ag
On 2015-03-18 02:41, Chris Kavanagh wrote:
I have a simple script that takes user input (for an Employee) such as
name, age, etc then puts in an sqlite3 database. The script worked fine
until I realized one problem. The age input field is defined in
SQLAlchemy as an Integer, so if a user inputs a
Le 08/06/2010 10:03, ch1zra a écrit :
import os, time, re, pyodbc, Image, sys
from datetime import datetime, date, time
from reportlab.lib.pagesizes import A4
from reportlab.lib.units import cm
from reportlab.pdfgen import canvas
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttf
ch1zra a écrit :
On Jun 8, 10:59 am, Bryan wrote:
Python doesn't have one global namespace. Each module (file) has its
own namespace, which is a Python dict, and 'global' means defined in
the containing module's dict. Put the import:
from reportlab.pdfgen import canvas
in the mkTable.py fil
Peter Otten wrote:
> Chris Rebert wrote:
[...]
> > The only global variable defined in mkTable.py is the "mkTable"
> > function (partly since you don't import anything). So the reference to
> > the global variable "canvas" on the right-hand side of this expression
> > is completely undefined, resul
Chris Rebert wrote:
> On Tue, Jun 8, 2010 at 2:00 AM, ch1zra wrote:
>> On Jun 8, 10:29 am, Richard Thomas wrote:
>>> On Jun 8, 9:03 am, ch1zra wrote:
>>> > I have following code :
>>>
>>> > import os, time, re, pyodbc, Image, sys
>>> > from datetime import datetime, date, time
>>> > from report
On Jun 8, 10:59 am, Bryan wrote:
> ch1zra wrote:
> > I have following code :
>
> > import os, time, re, pyodbc, Image, sys
> > from datetime import datetime, date, time
> > from reportlab.lib.pagesizes import A4
> > from reportlab.lib.units import cm
> > from reportlab.pdfgen import canvas
> > fro
On Tue, Jun 8, 2010 at 2:00 AM, ch1zra wrote:
> On Jun 8, 10:29 am, Richard Thomas wrote:
>> On Jun 8, 9:03 am, ch1zra wrote:
>> > I have following code :
>>
>> > import os, time, re, pyodbc, Image, sys
>> > from datetime import datetime, date, time
>> > from reportlab.lib.pagesizes import A4
>>
On Jun 8, 10:29 am, Richard Thomas wrote:
> On Jun 8, 9:03 am, ch1zra wrote:
>
>
>
>
>
> > I have following code :
>
> > import os, time, re, pyodbc, Image, sys
> > from datetime import datetime, date, time
> > from reportlab.lib.pagesizes import A4
> > from reportlab.lib.units import cm
> > from
ch1zra wrote:
> I have following code :
>
> import os, time, re, pyodbc, Image, sys
> from datetime import datetime, date, time
> from reportlab.lib.pagesizes import A4
> from reportlab.lib.units import cm
> from reportlab.pdfgen import canvas
> from reportlab.pdfbase import pdfmetrics
> from repor
On Jun 8, 9:03 am, ch1zra wrote:
> I have following code :
>
> import os, time, re, pyodbc, Image, sys
> from datetime import datetime, date, time
> from reportlab.lib.pagesizes import A4
> from reportlab.lib.units import cm
> from reportlab.pdfgen import canvas
> from reportlab.pdfbase import pdf
Gabriel Rossetti wrote:
Dave Angel wrote:
Gabriel Rossetti wrote:
Hello
everyone,
I get this error on python 2.6.1 on mac os x 10.6 :
UnboundLocalError: local variable '_[1]' referenced before assignment
here's the code that raises this:
params = [ self.__formatData(paramProcFunc, query, p
Gabriel Rossetti wrote:
Gabriel Rossetti wrote:
I get this error on python 2.6.1 on mac os x 10.6 :
UnboundLocalError: local variable '_[1]' referenced before assignment
here's the code that raises this:
params = [ self.__formatData(paramProcFunc, query, p) for p in params ]
what I don't g
Richard Thomas writes:
> That isn't an error that should occur, not least because _[1] isn't a
> valid name. Can you post a full traceback?
The name _[n] is used internally when compiling list comprehensions.
The name is chosen precisely because it is not an (otherwise) valid
identifier. For ex
Dave Angel wrote:
Gabriel Rossetti wrote:
Hello
everyone,
I get this error on python 2.6.1 on mac os x 10.6 :
UnboundLocalError: local variable '_[1]' referenced before assignment
here's the code that raises this:
params = [ self.__formatData(paramProcFunc, query, p) for p in params ]
what
Richard Thomas a écrit :
On Dec 9, 10:17 am, Gabriel Rossetti
wrote:
UnboundLocalError: local variable '_[1]' referenced before assignment
That isn't an error that should occur, not least because _[1] isn't a
valid name
It's an internal identifier used in list comps. Implementation detail
Gabriel Rossetti wrote:
Hello
everyone,
I get this error on python 2.6.1 on mac os x 10.6 :
UnboundLocalError: local variable '_[1]' referenced before assignment
here's the code that raises this:
params = [ self.__formatData(paramProcFunc, query, p) for p in params ]
what I don't get is tha
On Dec 9, 10:17 am, Gabriel Rossetti
wrote:
> Hello everyone,
>
> I get this error on python 2.6.1 on mac os x 10.6 :
>
> UnboundLocalError: local variable '_[1]' referenced before assignment
>
> here's the code that raises this:
>
> params = [ self.__formatData(paramProcFunc, query, p) for p in p
Duncan Booth wrote:
/ class CallableOnlyOnce(object):
/def __init__(self, func):
self.func = func
def __call__(self):
f = self.func
if f:
self.func = None
return f()
/ def callonce(func):
/ return CallableOnlyOnce(func)
/ @callonce
/
Rich Healey wrote:
> It seems that my problem was that I can't assign a new function to the
> name func within the callonce() function. I can however interact with
> the func object (in this case storing information about whether or not
> I'd called it in it's __RECALL item.
>
> Is there a clean
On Tue, 2009-09-29 at 21:15 -0700, Rich Healey wrote:
> However:
>
> def callonce(func):
> def nullmethod(): pass
> def __():
> return func()
> func = nullmethod
> return ret
> return __
>
> @callonce
> def t2():
> print "T2 called"
> t2()
>
> Gives me:
>
On Tue, Sep 29, 2009 at 9:41 PM, Chris Rebert wrote:
> On Tue, Sep 29, 2009 at 9:15 PM, Rich Healey wrote:
>> However:
>>
>> def callonce(func):
>> def nullmethod(): pass
>> def __():
>> return func()
>> func = nullmethod
Additionally, to rebind a variable in an outer nested
On Tue, Sep 29, 2009 at 9:15 PM, Rich Healey wrote:
> However:
>
> def callonce(func):
> def nullmethod(): pass
> def __():
> return func()
> func = nullmethod
When Python sees this assignment to func as it compiles the __()
method, it marks func as a local variable and will n
On Sep 30, 2:15 pm, Rich Healey wrote:
> I'm trying to write a decorator that causes a function to do nothing
> if called more than once- the reason for this is trivial and to see if
> I can (Read- I'm enjoying the challenge, please don't ruin it for me
> =] )
>
> However I'm getting strange resul
illiers
wrote:
From: Bruno Desthuilliers
Subject: Re: UnboundLocalError - (code is short & simple)
To: python-list@python.org
Date: Monday, September 28, 2009, 8:24 AM
Chris Rebert a écrit :
> On Sun, Sep 27, 2009 at 8:5
rtin
--- On Mon, 9/28/09, Chris Kaynor wrote:
From: Chris Kaynor
Subject: Re: UnboundLocalError - (code is short & simple)
To: python-list@python.org
Date: Monday, September 28, 2009, 4:00 PM
On Sun, Sep 27, 2009 at 10:39 PM, New User wrote:
Hi Chris,
Thank you for the reply and info!
on the python list - I just forgot to remove you
from it (I used G-Mail's reply all). In general, unless the reply is
off-topic or personal, it should be replied to on-list. This allows more
people to both see the answer and to help further explain the answer.
>
> --- On *Mon, 9/28/09, Chris Ka
On Sep 28, 6:07 am, pylearner wrote:
> System Specs:
>
> Python version = 2.6.1
> IDLE
> Computer = Win-XP, SP2 (current with all windows updates)
>
> ----
>
> Greetings:
>
> I have written code for two things: 1
Chris Rebert a écrit :
On Sun, Sep 27, 2009 at 8:53 PM, pylearner wrote:
---
Traceback (most recent call last):
File "", line 1, in
toss_winner()
File "C:/Python26/toss_winner.py", line 7, in toss_winner
coin_toss = coin
On Sun, Sep 27, 2009 at 8:53 PM, pylearner wrote:
> ---
>
> Traceback (most recent call last):
> File "", line 1, in
> toss_winner()
> File "C:/Python26/toss_winner.py", line 7, in toss_winner
> coin_toss = coin_toss()
> Unb
Lets look at what is happening on a few of the lines here:
First:
from coin_toss import coin_toss
imports the module coin_toss and sets the local variable coin_toss to the
value of coin_toss in the module coin_toss.
Second:
coin_toss = coin_toss()
calls the function bound to the name coin_toss
Mr SZ wrote:
Hi,
I am writing a small script that changes my pidgin status to away when I
lock my screen.I'm using the DBUS API for pidgin and
gnome-screensaver.Here's the code:
#!/usr/bin/env python
import dbus, gobject
from dbus.mainloop.glib import DBusGMainLoop
dbus.mainloop.glib.DBu
> def processLogEntry(entry):
# ADD THIS TO YOUR CODE
global cmterID_
>
>revision = int(entry.getRevision())
>commiter = str(entry.getAuthor())
>datetime = getTimeStamp(entry.getDate())
>message = str(entry.getMessage())
>
>Commiter_[0] = cmterID_ //HERE's THE PROBLEM
The r
> def processLogEntry(entry):
# ADD THIS TO YOUR CODE
global cmterID_
>
>revision = int(entry.getRevision())
>commiter = str(entry.getAuthor())
>datetime = getTimeStamp(entry.getDate())
>message = str(entry.getMessage())
>
>Commiter_[0] = cmterID_ //HERE's THE PROBLEM
The r
Oh thank you for pointing that out Fredrik, you made the case more
clear:)
On Nov 11, 7:19 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Camellia wrote:
> > Oh how can I thank you enough, you make my day:)
> > According to what you said I finally figure it out, it is the same as:
>
> >
> > b = 1
Camellia wrote:
> Oh how can I thank you enough, you make my day:)
> According to what you said I finally figure it out, it is the same as:
>
>
> b = 1
> def a():
> b = b #no good:)
>
if you really want to modify a variable that lives outside the function,
you can use the "global" directi
Oh how can I thank you enough, you make my day:)
According to what you said I finally figure it out, it is the same as:
b = 1
def a():
b = b #no good:)
So in every day programming I should avoid using the same name for
different types of objects because they will step on each other, right?
Oh how can I thank you enough, you make my day:)
According to what you said I finally figure it out, it is the same as:
b = 1
def a():
b = b #no good:)
So in every day programming I should avoid using the same name for
different objects because they will step on each other, right?
On Nov 1
At Saturday 11/11/2006 02:35, Camellia wrote:
But sorry I'm so dumb I can't say I really understand,
what do I actually do when I define a function with its name "number"?
Don't apologize, Python is a lot more dumb than you. It obeys very
simple rules (a good thing, so we can clearly understa
Thank you all so much for all the replies:)
But sorry I'm so dumb I can't say I really understand,
what do I actually do when I define a function with its name "number"?
why does a name of a function has something to do with a variable?
Oh wait can I do this in Python?:
def a():
def b()
so
Terry Reedy wrote in
news:[EMAIL PROTECTED] in
comp.lang.python:
>> def main():
>>number = number()
>
> Within a function, a given name can be either global or local, but not
> both.
> Here you are expecting the compiler to interpret the first occurance
> of 'number' as local and the second
"Camellia" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> hi all
>
> why it generates an "UnboundLocalError" when I do the following:
>
>
> ...
Presumably, the elided code includes a 'def number():' statement
> def main():
>number = number()
Within a function, a given name
Hello,
Camellia wrote:
> why it generates an "UnboundLocalError" when I do the following:
>
>
> ...
> def main():
> number = number()
> number_user = user_guess()
> while number_user != number:
> check_number(number = number, number_user = number_user)
> number_user
David Bear wrote:
> I'm attempting to use the cgi module with code like this:
>
> import cgi
> fo = cgi.FieldStorage()
> # form field names are in the form if 'name:part'
> keys = fo.keys()
> for i in keys:
> try:
> item,value=i.split(':')
> except NameError, Unboun
Kent Johnson wrote:
> Tim Hochberg wrote:
>
>>Kent Johnson wrote:
>>
>>>David Bear wrote:
>>>
>>>
I'm attempting to use the cgi module with code like this:
import cgi
fo = cgi.FieldStorage()
# form field names are in the form if 'name:part'
keys = fo.keys()
for i in ke
"David Bear" wrote:
> I'm attempting to use the cgi module with code like this:
>
> import cgi
> fo = cgi.FieldStorage()
> # form field names are in the form if 'name:part'
> keys = fo.keys()
> for i in keys:
> try:
> item,value=i.split(':')
> except NameError, Unbo
Tim Hochberg wrote:
> Kent Johnson wrote:
>
>>David Bear wrote:
>>
>>
>>>I'm attempting to use the cgi module with code like this:
>>>
>>>import cgi
>>>fo = cgi.FieldStorage()
>>># form field names are in the form if 'name:part'
>>>keys = fo.keys()
>>>for i in keys:
>>> try:
>>>
Tim Hochberg wrote:
> Kent Johnson wrote:
>> David Bear wrote:
>>
>>> I'm attempting to use the cgi module with code like this:
>>>
>>> import cgi
>>> fo = cgi.FieldStorage()
>>> # form field names are in the form if 'name:part'
>>> keys = fo.keys()
>>> for i in keys:
>>>try:
>>>
Kent Johnson wrote:
> David Bear wrote:
>
>>I'm attempting to use the cgi module with code like this:
>>
>>import cgi
>>fo = cgi.FieldStorage()
>># form field names are in the form if 'name:part'
>>keys = fo.keys()
>>for i in keys:
>>try:
>>item,value=i.split(':')
>>
David Bear wrote:
> I'm attempting to use the cgi module with code like this:
>
> import cgi
> fo = cgi.FieldStorage()
> # form field names are in the form if 'name:part'
> keys = fo.keys()
> for i in keys:
> try:
> item,value=i.split(':')
> except NameError, Unboun
Em Seg, 2006-04-10 às 11:29 -0700, David Bear escreveu:
> However, the except block does not seem to catch the exception and an
> unboundlocalerror is thrown anyway. What am I missing?
See http://docs.python.org/tut/node10.html :
"""
A try statement may have more than one except clause, to specif
[EMAIL PROTECTED] schrieb:
> Can you please tell me what is the meaning this error in general?
>
> UnboundLocalError: local variable 'colorIndex' referenced before
> assignment
>
> In my python script,
> I have a variable define and init to 0, like this
> colorIndex = 0
>
> and in one of my fu
[EMAIL PROTECTED] wrote in news:1140987642.195734.187540
@t39g2000cwt.googlegroups.com:
> Can you please tell me what is the meaning this error in general?
>
> UnboundLocalError: local variable 'colorIndex' referenced before
> assignment
>
> In my python script,
> I have a variable define and i
62 matches
Mail list logo