Hello there,
I am somewhat fluent in python ... good enough for the daily business
scripting stuff. I have a little script that I use to start the afs
service
on my machine and to collect tokens for multiple afs cells.
I want to enter the password using a GUI window (stdin
in a terminal window is
Hi!
IronPython is an implementation of Python.
IMO, this group talk about all Pythons.
Therefore, for me, this group is OK.
--
Michel Claveau
--
http://mail.python.org/mailman/listinfo/python-list
I am trying to retrieve the value of the exception (the message part)
raised in python, in C.
Running the below script,
import shutil
fd= open("testfile","w")
fd.write("some junk")
fd.close()
shutil.copy("testfile","testfile")
will generate an exception like this,
Traceback (most recent call la
pradeep writes:
> #!/usr/bin/env python
> name = "blah"
> print name
These two lines are indented, but are not inside a block.
> bash# /usr/bin/python sample.py
> File "sample.py", line 2
> name = "blah"
> ^
> SyntaxError: invalid syntax
Indentation is syntax in Python.
> An
pradeep wrote:
I have this file in linux
===
sample.py
#!/usr/bin/env python
name = "blah"
print name
...
Any one knows , whats the syntax error here?
You're indenting for no reason.
--
Erik Max Francis && m...@alcyone.com && http://www.alcyone.com/max/
San Jos
I have this file in linux
===
sample.py
#!/usr/bin/env python
name = "blah"
print name
---
I executed this
bash# ./sample.py
File "./sample.py", line 2
name = "blah"
^
bash# /usr/bin/python sample.py
File "sample.py", line
Nevermind I figured it out...
I set self.dummyvar = self.scrolledtext.component('rowheader')
and then did something like so self.dummyvar.index("@%d,%d" %
(event.x,event.y))
not sure why it worked like that...but it did :-)
--
http://mail.python.org/mailman/listinfo/python-list
Zac Burns gmail.com> writes:
> I'm trying to match any function block,
the two examples were just a part of
my unit tests.
I know. I was just giving an example to indicate why it doesn't work.
find_pattern.py is useful because it gives you a base from which
it's easy to
extrapolate the genera
* Steven D'Aprano:
[snip]
The obvious follow-up is to ask how to make an immutable class.
http://northernplanets.blogspot.com/2007/01/immutable-instances-in-python.html
Thanks, I've been wondering about that.
By the way, the link at the bottom in the article you linked to, referring to an
On Wed, Nov 25, 2009 at 09:38:54AM -0800, doug wrote:
>
> When I type C-c C-c my emacs window just hangs. If I use Task Manager
> to kill cmdproxy I can get emacs back but of course interactivity with
> Python is not accomplished. By the way, if I do C-c ! then I get a
> functional python shell.
On Tue, Dec 22, 2009 at 3:21 PM, Benjamin Peterson wrote:
>
> The pattern for that is funcdef< 'def' 'singleLineFunc' parameters< '(' ')'
> >
> ':' simple_stmt< return_stmt< 'return' arith_expr< '1' '+' '2' > > '\n' >
> >. No
> suite.
>
>
I'm trying to match any function block, the two examples we
mattia wrote:
Il Tue, 22 Dec 2009 23:09:04 +0100, Peter Otten ha scritto:
mattia wrote:
Is there a function to initialize a dictionary? Right now I'm using:
d = {x+1:[] for x in range(50)}
Is there any better solution?
There is a dictionary variant that you don't have to initialize:
from co
Victor Subervi wrote:
Hi;
I have the following code:
print 'printTheForm: ', descrProds, ''
for value in descrProds:
print 'value: ', value, ''
which prints this:
printTheForm: [['ID', 'tinyint', '5', '0', None], ['SKU', 'varchar',
'40', '', None], ['Category', 'varchar', '40', '',
On Dec 22, 11:51 pm, mattia wrote:
> Il Tue, 22 Dec 2009 23:09:04 +0100, Peter Otten ha scritto:
>
> > mattia wrote:
>
> >> Is there a function to initialize a dictionary? Right now I'm using:
> >> d = {x+1:[] for x in range(50)}
> >> Is there any better solution?
>
> > There is a dictionary varia
Lie Ryan wrote:
On 12/22/2009 11:25 PM, Steve Holden wrote:
>
> If you want to extract an index number from the first part of of a
given
> line use split( split_character, maximum_splits_to_do ) and then
angle
> brackets to reference the first part (index 0)...
>
>
a = "20 GOTO 10"
Il Tue, 22 Dec 2009 23:09:04 +0100, Peter Otten ha scritto:
> mattia wrote:
>
>> Is there a function to initialize a dictionary? Right now I'm using:
>> d = {x+1:[] for x in range(50)}
>> Is there any better solution?
>
> There is a dictionary variant that you don't have to initialize:
>
> from
En Tue, 22 Dec 2009 16:30:58 -0300, r0g
escribió:
Gabriel Genellina wrote:
En Mon, 21 Dec 2009 16:30:13 -0300, Pulkit Agrawal
escribió:
I am writing a script wherein I need to merge files into existing
tar.gz
files. Currently, I am using tarfile module. I extract the tar.gz to a
tempdir a
Dan Sommers wrote:
On Mon, 14 Dec 2009 14:14:05 -0500, python wrote:
Is there an os independent way to check if a python app is running?
Goal: I have a server program based on cherrypy that I only want to have
running once. If a system administrator accidentally attempts to run
this program mo
Zac Burns gmail.com> writes:
>
>
> Greetings,I'm trying to re-purpose the lib2to3 module and along the way came
up with this pattern:"funcdef<'def' name=NAME parameters ['->' test] ':'
suite=suite>"It seems to have 2 problems:
>
> Single-line defs are not matched. Eg: "def singleLineFunc(): re
On Tue, 22 Dec 2009 17:33:04 +0100, John wrote:
> Hi there,
>
> I have a rather lengthy program that troubles me for quite some time.
> After some debugging, I arrived at the following assertion error:
>
> for e in edges.keys():
> assert edges.has_key(e)
>
> Oops!? Is there ANY way that s
Il Tue, 22 Dec 2009 23:09:04 +0100, Peter Otten ha scritto:
> mattia wrote:
>
>> Is there a function to initialize a dictionary? Right now I'm using:
>> d = {x+1:[] for x in range(50)}
>> Is there any better solution?
>
> There is a dictionary variant that you don't have to initialize:
>
> from
On Tue, 22 Dec 2009 17:47:14 +0100, Christian Heimes wrote:
> John schrieb:
>> Hi there,
>>
>> I have a rather lengthy program that troubles me for quite some time.
>> After some debugging, I arrived at the following assertion error:
>>
>> for e in edges.keys():
>> assert edges.has_key(e)
>
mattia wrote:
> Is there a function to initialize a dictionary?
> Right now I'm using:
> d = {x+1:[] for x in range(50)}
> Is there any better solution?
There is a dictionary variant that you don't have to initialize:
from collections import defaultdict
d = defaultdict(list)
Peter
--
http://ma
Victor Subervi wrote:
Hi;
I have the following code:
print 'printTheForm: ', descrProds, ''
for value in descrProds:
print 'value: ', value, ''
which prints this:
printTheForm: [['ID', 'tinyint', '5', '0', None], ['SKU', 'varchar', '40',
'', None], ['Category', 'varchar', '40', '', Non
"mattia" wrote in message
news:4b313b3a$0$1135$4fafb...@reader1.news.tin.it...
Is there a function to initialize a dictionary?
Right now I'm using:
d = {x+1:[] for x in range(50)}
Is there any better solution?
Depending on your use case, a defaultdict might suite you:
from collections impo
On 22-12-2009 22:33, mattia wrote:
Is there a function to initialize a dictionary?
Right now I'm using:
d = {x+1:[] for x in range(50)}
Is there any better solution?
Maybe you can use:
dict.fromkeys(xrange(1,51))
but this will initialize all values to None instead of an empty list...
-
On 12/22/2009 1:33 PM mattia said...
Is there a function to initialize a dictionary?
Right now I'm using:
d = {x+1:[] for x in range(50)}
Is there any better solution?
I tend to use setdefault and fill in as I go, but if you need to have a
complete 50-element dict from the get go, I'd probably
On 2009-12-22 15:33 PM, mattia wrote:
Is there a function to initialize a dictionary?
Right now I'm using:
d = {x+1:[] for x in range(50)}
Is there any better solution?
For things like this? No. If you find yourself writing this pattern frequently,
though, you can wrap it up in a function and
Is there a function to initialize a dictionary?
Right now I'm using:
d = {x+1:[] for x in range(50)}
Is there any better solution?
--
http://mail.python.org/mailman/listinfo/python-list
On Dec 22, 11:05 am, "Gabriel Genellina"
wrote:
> En Tue, 22 Dec 2009 12:31:37 -0300, Marc Grondin
> escribió:
>
> > Hello everyone,
> > So i have been building an app with python(and learning as i go along) my
> > knowledge of python is still kinda limited but the app work on my pc. I
> > ha
On 12/22/2009 11:33 AM, John wrote:
Hi there,
I have a rather lengthy program that troubles me for quite some time. After
some debugging, I arrived at the following assertion error:
for e in edges.keys():
assert edges.has_key(e)
If you are claiming that the above *did* raise Assertion
On 12/22/2009 10:57 AM Victor Subervi said...
Hi;
I have the following code:
print 'printTheForm: ', descrProds, ''
This doesn't match what you say the below is the output from. There's
no below...
for value in descrProds:
print 'value: ', value, ''
When I assign your result la
On Dec 21, 9:33 pm, jordilin wrote:
> Hi,
> I've a config forloggingwhere I set up a file rotation with
> handlers.RotatingFileHandler and when the app parses thelogging
> config it says keyError when trying to parse that section
> ('RotatingFileHandler' is not defined). Curiously enough, I can d
Steve Holden wrote:
> r0g wrote:
>> seafoid wrote:
>>> Hi Guys,
>>>
>>> When python reads in a file, can lines be referred to via an index?
>>>
>>> Example:
>>>
>>> for line in file:
>>> if line[0] == '0':
>>> a.write(line)
>>>
>>> This works, however, I am unsure if line[0] refers on
Gabriel Genellina wrote:
> En Mon, 21 Dec 2009 16:30:13 -0300, Pulkit Agrawal
> escribió:
>
>> I am writing a script wherein I need to merge files into existing tar.gz
>> files. Currently, I am using tarfile module. I extract the tar.gz to a
>> tempdir and copy the new file there and re-compress
ok so that got me a little further. The app now works on win2k but on winXP
i get this:
File "printorders.py", line 2, in
File "win32ui.pyc", line 12, in
File "win32ui.pyc", line 10, in __load
ImportError: DLL load failed: This application has failed to start because
the a
pplication config
"Georg" wrote in message
news:7pb8ubfll...@mid.individual.net...
Hi Mark,
many thanks for your valuable help.
# numVars contains size of returned arrays. Recast to access.
varNamesArray = c.cast(varNames,c.POINTER(PCHAR * numVars.value))
varTypesArray = c.cast(varTypes,c.POINTER(INT * numV
Hi;
I have the following code:
print 'printTheForm: ', descrProds, ''
for value in descrProds:
print 'value: ', value, ''
which prints this:
printTheForm: [['ID', 'tinyint', '5', '0', None], ['SKU', 'varchar', '40',
'', None], ['Category', 'varchar', '40', '', None], ['Name', 'varchar',
On 12/23/2009 3:33 AM, John wrote:
Hi there,
I have a rather lengthy program that troubles me for quite some time. After
some debugging, I arrived at the following assertion error:
for e in edges.keys():
assert edges.has_key(e)
Oops!? Is there ANY way that something like this can possi
On 12/22/2009 10:47 AM, Gib Bogle wrote:
This is indented over one indentation level too much. You want it to
be at the same level as the for above. Here, its at the same level
with "t" -- meaning this entire loop gets repeated five times.
I sorta really recommend a tab width of 4 spaces, not 2
I need to run a cmd line app from python whose run time can vary from a
fraction of a second to minutes. I need to be able to tell whether the process
is still waiting, or whether it has stalled - and this is farily easily done by
keeping an eye on whether its writing to stdout or not. The pro
Some may find useful to compare:
- A Crash Course on Django
http://articles.sitepoint.com/article/django-crash-course
- A Crash Course on Web2py
http://www.web2py.com/AlterEgo/default/show/253
They basically describe the same app and the steps to built it. Sorry
I had not time to make screenshot
the CLI for sqlite3 shows .mode of "html", which formats the output in
HTML format that is good to add to .
BUT i have not yet found anything for sqlite in python that does this.
in fact, i found an old post saying 'if you want the output in a
table, you must create it yourself'.
Does anyone kno
On 12/22/2009 12:06 PM, W. eWatson wrote:
Stephen Hansen wrote:
On Mon, Dec 21, 2009 at 2:57 PM, W. eWatson
wrote:
[snip
Now, I go to the script and enter
from math import *
dir is now bulked up with the math functions. I change back math.cos
to cos
and the program runs well.
This sort of fig
On 22 dic, 18:22, "Gabriel Genellina" wrote:
> En Tue, 22 Dec 2009 14:04:23 -0300, vsoler
> escribió:
>
> > I'm using Python 2.6.4 on Windows (Vista & 7)
>
> > I usually start Python by clicking on Start Menu the Python IDLE
> > (Python GUI).
>
> > However, if I want to save a new source *.py f
On 12/22/2009 11:25 PM, Steve Holden wrote:
>
> If you want to extract an index number from the first part of of a given
> line use split( split_character, maximum_splits_to_do ) and then angle
> brackets to reference the first part (index 0)...
>
>
a = "20 GOTO 10"
int( a.split('
Greetings,
I'm trying to re-purpose the lib2to3 module and along the way came up with
this pattern:
"funcdef<'def' name=NAME parameters ['->' test] ':' suite=suite>"
It seems to have 2 problems:
1. Single-line defs are not matched. Eg: "def singleLineFunc(): return 1
+ 2" is not matched,
En Tue, 22 Dec 2009 14:04:23 -0300, vsoler
escribió:
I'm using Python 2.6.4 on Windows (Vista & 7)
I usually start Python by clicking on Start Menu the Python IDLE
(Python GUI).
However, if I want to save a new source *.py file, the default
directory proposed for saving is not the one that
En Tue, 22 Dec 2009 13:56:36 -0300, John escribió:
another thread can remove the key prior to the has_key call; or perhaps
edges isn't a real dictionary?
of course. But unless there is a way of using threading without being
aware of
it, this is not the case. Also, edges is definitely a di
vsoler wrote:
I'm using Python 2.6.4 on Windows (Vista & 7)
I usually start Python by clicking on Start Menu the Python IDLE
(Python GUI).
However, if I want to save a new source *.py file, the default
directory proposed for saving is not the one that I want.
What can I do if I want that the c
John wrote:
another thread can remove the key prior to the has_key call; or perhaps
edges isn't a real dictionary?
of course. But unless there is a way of using threading without being aware of
it, this is not the case. Also, edges is definitely a dict (has been declared
some lines before,
On Tue, Dec 22, 2009 at 8:56 AM, John wrote:
> > another thread can remove the key prior to the has_key call; or perhaps
> > edges isn't a real dictionary?
> >
>
> of course. But unless there is a way of using threading without being aware
> of
> it, this is not the case. Also, edges is definite
En Tue, 22 Dec 2009 12:31:37 -0300, Marc Grondin
escribió:
Hello everyone,
So i have been building an app with python(and learning as i go along) my
knowledge of python is still kinda limited but the app work on my pc. I
have
also compiled it to an exe using py2exe and it also works fine th
I'm using Python 2.6.4 on Windows (Vista & 7)
I usually start Python by clicking on Start Menu the Python IDLE
(Python GUI).
However, if I want to save a new source *.py file, the default
directory proposed for saving is not the one that I want.
What can I do if I want that the change of default
> another thread can remove the key prior to the has_key call; or perhaps
> edges isn't a real dictionary?
>
of course. But unless there is a way of using threading without being aware of
it, this is not the case. Also, edges is definitely a dict (has been declared
some lines before, and no ob
On Tue, Dec 22, 2009 at 12:08 PM, Emile van Sebille wrote:
> On 12/21/2009 10:27 PM Victor Subervi said...
>
> Hi;
>> Back when I worked with Zope, they had this nifty form element where I
>> could select from a list of elements on the right and click an arrow to make
>> them go into a list on t
John schrieb:
> Hi there,
>
> I have a rather lengthy program that troubles me for quite some time. After
> some debugging, I arrived at the following assertion error:
>
> for e in edges.keys():
> assert edges.has_key(e)
>
> Oops!? Is there ANY way that something like this can possibly ha
John wrote:
Hi there,
I have a rather lengthy program that troubles me for quite some time. After
some debugging, I arrived at the following assertion error:
for e in edges.keys():
assert edges.has_key(e)
Oops!? Is there ANY way that something like this can possibly happen?
Three w
On 22/12/2009 16:33, John wrote:
Hi there,
I have a rather lengthy program that troubles me for quite some time. After
some debugging, I arrived at the following assertion error:
for e in edges.keys():
assert edges.has_key(e)
Oops!? Is there ANY way that something like this can possibl
Hi,
I need to convert Python decimal.Decimal data to the XMLSchema xs:decimal
datatype. This is reasonably straightforward, but there are some corner cases.
In particular, xs:decimal does not allow exponential notation like:
>>> print Decimal('0.002343000837483727772')
2.343
Hi there,
I have a rather lengthy program that troubles me for quite some time. After
some debugging, I arrived at the following assertion error:
for e in edges.keys():
assert edges.has_key(e)
Oops!? Is there ANY way that something like this can possibly happen?
Cheers,
John
--
http:/
On 12/21/2009 10:27 PM Victor Subervi said...
Hi;
Back when I worked with Zope, they had this nifty form element where I
could select from a list of elements on the right and click an arrow to
make them go into a list on the left. I need to add this functionality
to the store I am creating. Wh
On Dec 21, 5:38 am, Oltmans wrote:
> Hello,. everyone.
>
> I've a string that looks something like
>
> lksjdfls kdjff lsdfs sdjfls = "amazon_35343433">sdfsdwelcome
>
>
> From above string I need the digits within the ID attribute. For
> example, required output from above string is
And the next question in the series - how to make sure the resulting
package has a setup.py file?
The basic steps are...
- build a python package
- create a minimal setup.py
- (github it, natch)
- throw it at pypi with:
python setup.py bdist upload
- attempt to install it with:
sud
Hello everyone,
So i have been building an app with python(and learning as i go along) my
knowledge of python is still kinda limited but the app work on my pc. I have
also compiled it to an exe using py2exe and it also works fine this way on
my pc(where python is installed) if however i try to run
On 12/22/2009 8:52 PM, Bruno Desthuilliers wrote:
Steve Holden a écrit :
(snip)
What's the exact reason for requiring that a creator argument be of a
specific type? So operations on the instances don't go wrong? Well, why
not just admit that we don't have control over everything, and just *let
t
thank you for your help and support. i`ll keep your advice in mind. :)
cheers!!!
Zubin
On Tue, Dec 22, 2009 at 8:07 PM, Lie Ryan wrote:
> On 12/22/2009 5:13 PM, Zubin Mithra wrote:
>>
>> I have the following two implementation techniques in mind.
>>
>> def myfunc(mystring):
>> check = "hel
On 12/22/2009 5:13 PM, Zubin Mithra wrote:
I have the following two implementation techniques in mind.
def myfunc(mystring):
check = "hello, there " + mystring + "!!!"
print check
OR
structure = ["hello, there",,"!!!"]
def myfunc(mystring):
structure[2] = mystring
output =
I want to use Markdown to process some text before displaying it in a
list. However, Markdown, by default, wraps the resulting text in
elements, which screws up my list and displays the list item symbol
and text on different lines. Can I stop Markdown from wrapping text in
paragraphs elements? Sor
how about re.findall(r'\w+.=\W\D+(\d+)?',str) ?
this will work for any string within id !
~Ukanth
On Dec 21, 6:06 pm, Oltmans wrote:
> On Dec 21, 5:05 pm, Umakanth wrote:
>
> > How about re.findall(r'\d+(?:\.\d+)?',str)
>
> > extracts only numbers from any string
>
> Thank you. However, I
Dear all, excuse me if i post a simple question.. I am trying to find
a software/algorythm that can "cluster" simple data on an excel sheet
Example:
Variable a Variable b Variable c
Case 11 0 0
Case 20 1
In article <00b967e1$0$15623$c3e8...@news.astraweb.com>,
Steven D'Aprano wrote:
>Nice work! But I have a question...
>
>On Mon, 21 Dec 2009 20:40:40 +, Albert van der Horst wrote:
>
>> def pi4():
>> ' Calculate pi by a 5th order process, with favorable stop
>> criterion'
>> precis
Zubin Mithra wrote:
I have the following two implementation techniques in mind.
def myfunc(mystring):
check = "hello, there " + mystring + "!!!"
print check
OR
structure = ["hello, there",,"!!!"]
def myfunc(mystring):
structure[2] = mystring
output = ''.join(mystring)
i heard
Bruno Desthuilliers wrote:
> Steve Holden a écrit :
> (snip)
>> What's the exact reason for requiring that a creator argument be of a
>> specific type? So operations on the instances don't go wrong? Well, why
>> not just admit that we don't have control over everything, and just *let
>> things go w
r0g wrote:
> seafoid wrote:
>> Hi Guys,
>>
>> When python reads in a file, can lines be referred to via an index?
>>
>> Example:
>>
>> for line in file:
>> if line[0] == '0':
>> a.write(line)
>>
>> This works, however, I am unsure if line[0] refers only to the first line or
>> the fir
jordilin wrote:
Hi,
I've a config for logging where I set up a file rotation with
handlers.RotatingFileHandler and when the app parses the logging
config it says keyError when trying to parse that section
('RotatingFileHandler' is not defined). Curiously enough, I can do
import logging and from
On Dec 22, 11:12 am, Luca wrote:
> Dear all, excuse me if i post a simple question.. I am trying to find
> a software/algorythm that can "cluster" simple data on an excel sheet
>
> Example:
> Variable a Variable b Variable c
> Case 1 1 0 0
"Gabriel Genellina" wrote:
> En Mon, 21 Dec 2009 11:39:46 -0300, Lucas Prado Melo
> escribió:
>
>> Is there a way to send() information back to a generator while using
the
>> for...in statement?
>
> No. You have to write the iteration as a while loop.
>
You *can* use send() to a generator w
Steve Holden a écrit :
(snip)
What's the exact reason for requiring that a creator argument be of a
specific type? So operations on the instances don't go wrong? Well, why
not just admit that we don't have control over everything, and just *let
things go wrong* when the wrong type is passed?
va
Denis Doria a écrit :
Hi;
I'm checking the best way to validate attributes inside a class. Of
course I can use property to check it, but I really want to do it
inside the __init__:
If you use a property, you'll have the validation in the initializer AND
everywhere else too. If you care about
On 12/22/09 7:13 AM, Zubin Mithra wrote:
I have the following two implementation techniques in mind.
def myfunc(mystring):
check = "hello, there " + mystring + "!!!"
print check
OR
structure = ["hello, there",,"!!!"]
def myfunc(mystring):
structure[2] = mystring
output = ''
>> I don't think Steven cares much, he loves this type of nitpicking and
>> uber pedantic formulations, but only if he can apply it to other
>> people's post :)
>
> Heh heh :)
>
> I actually do care, because (not having a Java/C++ background) I actually
> do get a mental "double-take" every time I
tekion wrote:
> All,
> I know there is a datetime module for converting and manipulate date
> format. I have this string date format: 24/Nov/2009:10:39:03 -0500
> and would like to convert it to a date format of "2009-11-24
> 10:39:03". At the moment I am reading datetime module trying to find
>
83 matches
Mail list logo