Re: Password authentication systems

2006-08-10 Thread Paul Rubin
AlbaClause <[EMAIL PROTECTED]> writes: > Correct me if I'm wrong, but I believe that all Linux passwords are > encrypted whether you enable shadow passwords or not. I believe that when > you enable shadow passwords, the encrypted passwords are stored in a file > other than 'passwd'. Is this not

Re: __contains__ vs. __getitem__

2006-08-10 Thread Alex Martelli
Pedro Werneck <[EMAIL PROTECTED]> wrote: > On Wed, 09 Aug 2006 16:51:23 GMT > "David Isaac" <[EMAIL PROTECTED]> wrote: > > > Looking forward: > > Can I count on this independence of __getitem__ and __contains__? > > I would like to understand whether it will be safe to count on this > > behavior.

Re: __contains__ vs. __getitem__

2006-08-10 Thread Alex Martelli
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > David Isaac wrote: > >> Alan Isaac wrote: > >>> I have a subclass of dict where __getitem__ returns None rather than > >>> raising KeyError for missing keys. (The why of that is not important > > for > >>> this question.) > > > > "Bruno Desthuilli

Re: How to change the path for python binary?

2006-08-10 Thread Alex Martelli
Nico Grubert <[EMAIL PROTECTED]> wrote: > Hi there, > > I have installed Python 2.3.5 on Suse Linux 10. > If I enter "python" in the shell, the Python 2.3.5 interpreter is called. > > After I installed Python 2.4.3. the Python 2.4.3 interpreter is called > which is the default behaviour I guess.

Re: ALLAH

2006-08-10 Thread James
> I dont know why post a subject like this here! Anyway, the post is in > Turkish and talks about Islam, with the format, sub-heading (which is a > main topic in Islamic belief) and then a story relating to the > sub-heading, which is used to explain the topic. He is an Internet Looney. According

Re: Password authentication systems

2006-08-10 Thread AlbaClause
[EMAIL PROTECTED] wrote: > This may only be tangentially related to Python, but since I am coding > a password authentication system in Python, I thought I would ask here. > > In Linux (and presumably other *NIX systems that support it), when > shadow passwords are enabled, the actual password is

Warlord *this*

2006-08-10 Thread Aahz
http://groups.google.com/group/soc.motss/msg/a41fbe0c17342f46 -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not sma

Re: semi-Newbie question

2006-08-10 Thread len
Thank all for your reply. I will try again to state the problem. I have three files. 1. Tagfile - This file contains data in a CSV format each record in the file contains three fields 'Tagname', 'Scope', and 'Value' and exampe of this data file follows; "totalpolicypremium","pol0","1584" "quote

Re: ALLAH

2006-08-10 Thread placid
[EMAIL PROTECTED] wrote: > > Ey insanlar ve cinler ezeli ve ebedi cennete girmek,ebedi yaşamak,her > istediğini yapmak ve Allah'ı görmek istemezmisiniz. > Ey sevgili ruh,bunun için Allah'a şükretmeli ve iman etmeli > değilmisin. > > HULASA : > Allah,birdir, hiçbirşeye ihtiyacı yoktur,ne birbaşka

Re: Python share CPU time?

2006-08-10 Thread neokosmos
[EMAIL PROTECTED] wrote: > You should take a look at stackless Python. It should do very nicely > for what you want. There is a good tutorial on it here: > http://members.verizon.net/olsongt/stackless/why_stackless.html Not being intimately familiar with Stackless myself, I wonder, how would

Re: Python share CPU time?

2006-08-10 Thread neokosmos
alex23 wrote: > Simon Forman wrote: > > This is just a dim memory, but something called lambdaMOO was (is?) a > > Multi-User Dungeon that had (has?) a model of processing that allowed > > you to create programmed objects that received a "budget" of processor > > time. The objects would not work i

Re: Python share CPU time?

2006-08-10 Thread neokosmos
Yannick wrote: > I would like to program a small game in Python, kind of like robocode > (http://robocode.sourceforge.net/). > Problem is that I would have to share the CPU between all the robots, > and thus allocate a time period to each robot. However I couldn't find > any way to start a thread

Re: hide python code !

2006-08-10 Thread Ben Finney
"Bayazee" <[EMAIL PROTECTED]> writes: > can we hide a python code ? Sure; don't distribute it to anyone. Then they can't run the program or inspect it or anything. > if i want to write a commercial software can i hide my source code > from users access ? You can write commercial software and se

Generator-based microthreads and games

2006-08-10 Thread neokosmos
I've seen various generator-based microthread implementations online, but I've been wondering: has anyone used microthreads in this manner in a game environment? Note, I am emphatically *not* referring to Stackless, which I know has been used in a production game environment; this post is referrin

Re: Python share CPU time?

2006-08-10 Thread alex23
Simon Forman wrote: > This is just a dim memory, but something called lambdaMOO was (is?) a > Multi-User Dungeon that had (has?) a model of processing that allowed > you to create programmed objects that received a "budget" of processor > time. The objects would not work if they "ran out" of proce

Re: error handling

2006-08-10 Thread Farshid Lashkari
Steven D'Aprano wrote: > That's broken. > > Imagine that somewhere in main() the following is called: > > D = {"a": "apple", "b": "bicycle", "c": "cat"} > print D["aardvark"] > > Your code now prints "That number is way too big!". That's not good. > > try...except blocks should, as a general r

Re: Password authentication systems

2006-08-10 Thread neokosmos
Paul Rubin wrote: > [EMAIL PROTECTED] writes: > > My goal is to keep user passwords as safe as possible, assuming someone > > did decide to steal the password files. > > How often will new accounts be added? I have an idea I might try to > code up. Frequently, I hope. Realistically, when I open

Re: ALLAH

2006-08-10 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > Kader; > > soru:madem,hersey bir kader defterinde yazili ve hersey ona göre > oluyor.o halde insanlar niçin cehenneme gidiyor? > cevap:evet hersey bir kader defterinde yazili ve hersey ona göre > oluyor.ama,defterde yazili oldugu için o sey olmuyor. Yes, we all underst

Re: Python share CPU time?

2006-08-10 Thread Simon Forman
Yannick wrote: > Thank you all for the detailled answers. > > What I would like to achieve is something like: > > # main loop > while True: > for robot in robots: > robot.start() > robot.join(0.2) # wait 200ms > if robot.is_active(): > robot.stop() > # ru

Re: error handling

2006-08-10 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Chris <[EMAIL PROTECTED]> wrote: >I want to do this because there are several spots in my program where >an error might occur that I want to handle the same way, but I don't >want to rewrite the try..except block again. Is that clearer? .

Re: hide python code !

2006-08-10 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >On Thu, 10 Aug 2006 17:03:51 -0700, Bayazee wrote: > >> hi >> in compiled languages when we compile a code to an executable file it >> convert to a machine code so now we cant access to source ... > >There are disassembler

Re: python/mysql/list question...

2006-08-10 Thread John Machin
bruce wrote: > hi. > > i have the following sample code. i'm trying to figure out if there's a way > to use a 'list of lists' in a mysql execute... > > i've tried a variety of combinations but i get an error: > Error 1241: Operand should contain 1 column(s) > > the test code is: > > insertSQL = "

Re: hide python code !

2006-08-10 Thread Simon Forman
Bayazee wrote: > hi > in compiled languages when we compile a code to an executable file it > convert to a machine code so now we cant access to source ... It can still be disassembled and reverse engineered. > but in python we easily open the program executable(ascii) file and > read source ...

Re: error handling

2006-08-10 Thread Steven D'Aprano
On Thu, 10 Aug 2006 16:59:56 -0700, Farshid Lashkari wrote: > Chris wrote: >> But sometimes you can have too many of these statements in your >> program, and it starts to get tangled and nasty looking. Is there a way >> I can modify sys.error so that when the interpreter comes accross an >> IndexE

Re: seaching a list...

2006-08-10 Thread Tim Chase
> the issue of doing the string/list compare/search is that i can get > everything from the db with one call... i can then iterate through memory > for each of my row information that i'm searching to see if it exists in the > db... > > memory searches should be faster than the network overhead, a

RE: python/mysql/list question...

2006-08-10 Thread bruce
never mind... doh!!! executemany as opposed to execute!!! thanks -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of bruce Sent: Thursday, August 10, 2006 6:37 PM To: python-list@python.org Subject: python/mysql/list question... hi. i have the following sa

python/mysql/list question...

2006-08-10 Thread bruce
hi. i have the following sample code. i'm trying to figure out if there's a way to use a 'list of lists' in a mysql execute... i've tried a variety of combinations but i get an error: Error 1241: Operand should contain 1 column(s) the test code is: insertSQL = """insert into appTBL

Packages

2006-08-10 Thread Bill Hale
I have a question on packages. Suppose I have a package P with modules A.py, B.py, and C.py. Suppose that C.py defines a class X. Assume that the package __init__.py file contains the statement "from C import X". If I write an external Python program H.py, then I can refer to the class X by doing

Re: seaching a list...

2006-08-10 Thread John Machin
bruce wrote: > hi larry... > > thanks for the reply... > > the issue i'm having is that i'm going to have to compare multiple rows of > information to the information in the db. so essentially i'd have to do a > hit to the db, for each row of information i want to compare if i did it > your way...

Re: reading from sockets

2006-08-10 Thread AlbaClause
AndrewTK wrote: > Hello, > > I'm trying to read data from a socket and I'm not seeing what I'm > expecting it seems to skip the first line of data. I am new to > Python and just trying to test what I can do with it... and it's not > looking pretty. > > > I have some Python code: > [

Switching a Dataprobe iP-415/815 (basic) using TCP

2006-08-10 Thread yaipa
>< #!/usr/bin/env python import socket import sys, time # -- # File: dataprobe.py # Author: Alan Haffner # Date: 2006-08-10 # Rev. .60 # # Tested on Linux only # # Usage: dataprobe.py # # $> dataprobe.py 5P 4 # $>

Re: error handling

2006-08-10 Thread John Machin
Chris wrote: > I want to handle errors for a program i'm building in a specific way, > but I don't want to use try/except/finally because it requires forming > new blocks of code. I want to be able things like this: > > a = [2, 423, "brownie", 234.34] > try: a[890] > except IndexError: # I don't u

RE: seaching a list...

2006-08-10 Thread bruce
hi larry... thanks for the reply... the issue i'm having is that i'm going to have to compare multiple rows of information to the information in the db. so essentially i'd have to do a hit to the db, for each row of information i want to compare if i did it your way... (which was what i had thoug

Rendering Vector Graphics

2006-08-10 Thread Hugo Ferreira
Hi ppl,I need to render high-quality vector graphics with Python. I was thinking of something like 'cairo', though I need to run under win32 and can't find a pycairo package for it. Suggestions?Thanks, Hugo Ferreira-- GPG Fingerprint: B0D7 1249 447D F5BB 22C5  5B9B 078C 2615 504B 7B85 -- http://ma

Re: Password authentication systems

2006-08-10 Thread Paul Rubin
[EMAIL PROTECTED] writes: > My goal is to keep user passwords as safe as possible, assuming someone > did decide to steal the password files. How often will new accounts be added? I have an idea I might try to code up. -- http://mail.python.org/mailman/listinfo/python-list

Re: hide python code !

2006-08-10 Thread enigmadude
I don't think you're the first person that has wondered about this. But you might have some options: 1. If you are running it on Windows only, use py2exe to wrap it up as an executable. 2. I've never done this, but you might be able to encrypt or otherwise turn you modules into binary form, and th

Re: easy string formating question

2006-08-10 Thread Simon Forman
Slawomir Nowaczyk wrote: > On Thu, 10 Aug 2006 11:39:41 -0700 > f pemberton <[EMAIL PROTECTED]> wrote: > > #> I have kind of an interesting string, it looks like a couple hundred > #> letters bunched together with no spaces. Anyway, i'm trying to put a > #> "?" and a (\n) newline after every 100t

Re: Password authentication systems

2006-08-10 Thread neokosmos
Paul Rubin wrote: > [EMAIL PROTECTED] writes: > > I had considered the hmac module. The thing that bugs me about it is > > that I'd have to keep this secret key around someplace accessible to > > the server. Most likely, this means storing it in a file. > > Yeah, this issue is traditionally a n

Re: error handling

2006-08-10 Thread Chris
I want to do this because there are several spots in my program where an error might occur that I want to handle the same way, but I don't want to rewrite the try..except block again. Is that clearer? And I meant sys.stderr... sorry 'bout that Simon Forman wrote: > Chris wrote: > > I want to hand

Re: hide python code !

2006-08-10 Thread Steven D'Aprano
On Thu, 10 Aug 2006 17:03:51 -0700, Bayazee wrote: > hi > in compiled languages when we compile a code to an executable file it > convert to a machine code so now we cant access to source ... There are disassemblers for machine code. If somebody really wants to see how your code works, they can d

Re: hide python code !

2006-08-10 Thread John Machin
Bayazee wrote: > hi > in compiled languages when we compile a code to an executable file it > convert to a machine code so now we cant access to source ... > but in python we easily open the program executable(ascii) file and > read source > i meen than any way to protect my code or convert

Re: hide python code !

2006-08-10 Thread Bayazee
hi in compiled languages when we compile a code to an executable file it convert to a machine code so now we cant access to source ... but in python we easily open the program executable(ascii) file and read source i meen than any way to protect my code or convert it to executable witch can n

Re: error handling

2006-08-10 Thread Simon Forman
Chris wrote: > I want to handle errors for a program i'm building in a specific way, > but I don't want to use try/except/finally because it requires forming > new blocks of code. I want to be able things like this: > > a = [2, 423, "brownie", 234.34] > try: a[890] > except IndexError: # I don't us

Re: error handling

2006-08-10 Thread Farshid Lashkari
Chris wrote: > But sometimes you can have too many of these statements in your > program, and it starts to get tangled and nasty looking. Is there a way > I can modify sys.error so that when the interpreter comes accross an > IndexError it prints "That number is way too big!" before it exits? Hi,

Re: hide python code !

2006-08-10 Thread John Machin
Bayazee wrote: > hi > can we hide a python code ? > if i want to write a commercial software can i hide my source code from [1] > users access ? > we can conver it to pyc but this file can decompiled ... so ...!! > do you have any idea about thi

Re: Python share CPU time?

2006-08-10 Thread Yannick
Thank you all for the detailled answers. What I would like to achieve is something like: # main loop while True: for robot in robots: robot.start() robot.join(0.2) # wait 200ms if robot.is_active(): robot.stop() # run all the game physics, pause, frame/

Re: converting a nested try/except statement into try/except/else

2006-08-10 Thread Simon Forman
John Salerno wrote: > Simon Forman wrote: > > > What about the version I gave you 8 days ago? ;-) > > > > http://groups.google.ca/group/comp.lang.python/msg/a80fcd8932b0733a > > > > It's clean, does the job, and doesn't have any extra nesting. > > > > Peace, > > ~Simon > > > > I remember that versi

error handling

2006-08-10 Thread Chris
I want to handle errors for a program i'm building in a specific way, but I don't want to use try/except/finally because it requires forming new blocks of code. I want to be able things like this: a = [2, 423, "brownie", 234.34] try: a[890] except IndexError: # I don't use 'finally' here because I

hide python code !

2006-08-10 Thread Bayazee
hi can we hide a python code ? if i want to write a commercial software can i hide my source code from users access ? we can conver it to pyc but this file can decompiled ... so ...!! do you have any idea about this ...? --- First Iranian Open Source Community :

Re: "running" code on client side with cherrypy?

2006-08-10 Thread Paul Rubin
"Mr BigSmoke" <[EMAIL PROTECTED]> writes: > Tnx Jay... as i supposed there's no easy solution... I just thought > that, maybe, being on an intranet there was a possible solution... There are ways to ask the user for permission to install stuff on the client (that's how self-installers work) but th

Re: Password authentication systems

2006-08-10 Thread Paul Rubin
[EMAIL PROTECTED] writes: > This is a password authentication system > intended for a game server (a MUD/MMOG, in fact). The real limiting > factor here is that I want to keep the server accessible via pure > telnet protocol. Otherwise, using SSH would make sense. If you're going to broadcast pa

Re: String Formatting

2006-08-10 Thread John Machin
OriginalBrownster wrote: > Hi there: > > I was wondering if its at all possible to search through a string for a > specific character. Don't wonder; read the tutorials, read the manuals, and ponder the sheer uselessness of any computer language that offered neither such a facility nor the means to

Re: seaching a list...

2006-08-10 Thread Larry Bates
bruce wrote: > hi... > > i'm playing with a test sample. i have somethhing like: > dog = mysql_get(.) > . > . > . > > such that 'dog' will be an 'AxB' array of data from the tbls > > furher in the test app, i'm going to have a list, foo: > foo = 'a','b','c','d' > > i'm trying to determ

Re: String Formatting

2006-08-10 Thread alisonken1
Sorry, missed an option in there: > def get_word(s, which=1, sep=','): > return s.split(sep)[which-1].strip() > > >>> > >>> get_word('bread, butter, milk') > 'milk' > > >>> >>> get_word('bread, butter, milk') 'bread' >>> get_word('bread, butter, milk', 3) 'milk' >>> get_word('bread is brown

Re: semi-Newbie question

2006-08-10 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, len <[EMAIL PROTECTED]> wrote: >I appoligize I don't think I have done a very good job of explaining my >problem. . . . >The program I am writing is nothing more than a conversion program to >tak

Re: loop until keypress (Windows XP)

2006-08-10 Thread placid
Thomas Guettler wrote: > Am Wed, 09 Aug 2006 22:19:24 -0700 schrieb placid: > > > Hi all, > > > > > > Im using the cmd module and i have command that loops and keeps on > > printing text, what i want to be able to do is loop until the user > > presses a particular key, say Q/q ? I tried the follow

FTP HANGS on very slow connection

2006-08-10 Thread Michal Seidl
Hi, I am trying to download data from remote ftp server connected through GSM modem. The speed is slow 1kB/s. Despite the classic linux ftp client works fine the ftp.retrbinary(),ftpretrlines() function from ftplib hangs. I am able succesfuly login but a can not download. It has probably something

Re: semi-Newbie question

2006-08-10 Thread John Machin
len wrote: > Hi all > > I have a file that I receive from another party which is basicly a csv > file containing the following type of information; > > Tagname Scope Value > "first_name","POL01","John" > "last_name","POL01","Doe" > "birthday","POL01","04/03/61" > etc > > I nee

Re: ANN: xtopdf: PDF creation / conversion toolkit: alpha release of v1.3

2006-08-10 Thread John J. Lee
[EMAIL PROTECTED] writes: > I'll be out of the office until approximately August 20th. If you have any > questions, please email [EMAIL PROTECTED] I'm sure all c.l.py readers eagerly await your return ;-) John -- http://mail.python.org/mailman/listinfo/python-list

Re: ALLAH

2006-08-10 Thread John J. Lee
Wildemar Wildenburger <[EMAIL PROTECTED]> writes: [...] > Although the subject sort of makes me suspect that this text has > little if anything to do with programming. Programming computers, that > is. :-)) John -- http://mail.python.org/mailman/listinfo/python-list

Re: What's the cleanest way to compare 2 dictionary?

2006-08-10 Thread John Machin
John Henry wrote: > John, > > Yes, there are several scenerios. > > a) Comparing keys only. > > That's been answered (although I haven't gotten it to work under 2.3 > yet) (1) What's the problem with getting it to work under 2.3? (2) Why not upgrade? > > b) Comparing records. You haven't got tha

Re: What's the cleanest way to compare 2 dictionary?

2006-08-10 Thread Paddy
John Machin wrote: > John Henry wrote: > > Hi list, > > > > I am sure there are many ways of doing comparision but I like to see > > what you would do if you have 2 dictionary sets (containing lots of > > data - like 2 keys and each key contains a dozen or so of records) > > and you want to bu

Re: converting a nested try/except statement into try/except/else

2006-08-10 Thread Boris Borcic
Boris Borcic wrote: > John Salerno wrote: >> In this case the method must return False, because it's a wxPython >> method that needs a True or False value. If it doesn't, the program >> will continue even after the error message. > > Just as it should do if the method returns True and no error m

Re: Python share CPU time?

2006-08-10 Thread Rhamphoryncus
Yannick wrote: > Hi, > > I would like to program a small game in Python, kind of like robocode > (http://robocode.sourceforge.net/). > Problem is that I would have to share the CPU between all the robots, > and thus allocate a time period to each robot. However I couldn't find > any way to start a

Re: Announcing Switch, the CSS Preprocessor!

2006-08-10 Thread John J. Lee
"Dave" <[EMAIL PROTECTED]> writes: > It's not tied deeply to mod_python. > > The processor works like this: > > You create an "sss" file, using Switch specific features. Then, you > place the file under Apache/mod_python OR you can use the command-line > Switch tool to process the SSS file and o

Re: "running" code on client side with cherrypy?

2006-08-10 Thread Mr BigSmoke
Tnx Jay... as i supposed there's no easy solution... I just thought that, maybe, being on an intranet there was a possible solution... About pysvn a tortoise... i do use tortoiseSVN and t works really really fine.. we (developers) use it, but i'm writting server for "normal" users that can checkout

Re: converting a nested try/except statement into try/except/else

2006-08-10 Thread Boris Borcic
John Salerno wrote: > In this case the method must return False, because it's a wxPython > method that needs a True or False value. If it doesn't, the program will > continue even after the error message. Just as it should do if the method returns True and no error message is produced if I und

Re: semi-Newbie question

2006-08-10 Thread len
I appoligize I don't think I have done a very good job of explaining my problem. I work in the an insurance company that sells non standard auto. We have an in house policy management system that uses MySQL for the data storage. An individual policy consists of a policy header and 1 to n drivers

Re: converting a nested try/except statement into try/except/else

2006-08-10 Thread Boris Borcic
Bruno Desthuilliers wrote: > Boris Borcic a écrit : >> Slawomir Nowaczyk wrote: >> >>> >>> try: >>> if int(text) > 0: >>>return True >>> except ValueError: >>> pass >>> self.error_message() >>> return False >>> >> >> Nicely DRY. To make it even more compact, it may be noticed that t

Re: using python to edit a word file?

2006-08-10 Thread John Henry
John Salerno wrote: > I figured my first step is to install the win32 extension, which I did, > but I can't seem to find any documentation for it. A couple of the links > on Mark Hammond's site don't seem to work. > > Anyway, all I need to do is search in the Word document for certain > strings and

Re: converting a nested try/except statement into try/except/else

2006-08-10 Thread John Salerno
Boris Borcic wrote: > Slawomir Nowaczyk wrote: >> >> try: >> if int(text) > 0: >>return True >> except ValueError: >> pass >> self.error_message() >> return False >> > > Nicely DRY. To make it even more compact, it may be noticed that the > default return value None is false in a

Re: How to write a Installer for a Python App in Linux

2006-08-10 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Hi, > > I have known python for about 3-4 months now. My knowledge is still > very limited. > > I wrote a small app using wxPython. Now, I want to create an installer > for it (on Linux platform.) for the people I developed this small > utility. > > These people use

Re: String Formatting

2006-08-10 Thread alisonken1
alisonken1 wrote: > OriginalBrownster wrote: > > > Example sorry, forgot the '... everything after the last comma ...' part. -- http://mail.python.org/mailman/listinfo/python-list

Re: String Formatting

2006-08-10 Thread alisonken1
OriginalBrownster wrote: > Example > > If i had a list:bread, butter, milk def get_word(s, which=1, sep=','): return s.split(sep)[which-1].strip() >>> >>> get_word('bread, butter, milk') 'milk' >>> -- http://mail.python.org/mailman/listinfo/python-list

Re: semi-Newbie question

2006-08-10 Thread danielx
len wrote: > Hi all > > I have a file that I receive from another party which is basicly a csv > file containing the following type of information; Python has a csv module. I'm not sure if you're already using that or if it would be useful to you: http://docs.python.org/lib/module-csv.html > > T

Re: converting a nested try/except statement into try/except/else

2006-08-10 Thread Bruno Desthuilliers
Boris Borcic a écrit : > Slawomir Nowaczyk wrote: > >> >> try: >> if int(text) > 0: >>return True >> except ValueError: >> pass >> self.error_message() >> return False >> > > Nicely DRY. To make it even more compact, it may be noticed that the > default return value None is false

Re: "running" code on client side with cherrypy?

2006-08-10 Thread jay graves
Mr BigSmoke wrote: > Hi All, > I'm developing a website to handle some code/application version > control on a intranet. I'm using cherrypy and pysvn. Everything runs > quite good but i want the user to be able to checkout some projects > from the server. The user(on the client side) selects a fold

Re: semi-Newbie question

2006-08-10 Thread davideugenewarren
Do you absolutely need to use variables? A dictionary would serve if each case has a unique identifier. client_info_dict = {} for i in tagfile: tagname,scope,value = i.replace('"','').split(',') # split fields, strip redundant characters client_info_dict.setdefault(scope,{}) # set up a

Re: What's the cleanest way to compare 2 dictionary?

2006-08-10 Thread John Henry
John, Yes, there are several scenerios. a) Comparing keys only. That's been answered (although I haven't gotten it to work under 2.3 yet) b) Comparing records. Now it gets more fun - as you pointed out. I was assuming that there is no short cut here. If the key exists on both set, and if I w

How to write a Installer for a Python App in Linux

2006-08-10 Thread diffuser78
Hi, I have known python for about 3-4 months now. My knowledge is still very limited. I wrote a small app using wxPython. Now, I want to create an installer for it (on Linux platform.) for the people I developed this small utility. These people use some customized variant of Red Hat Linux. I fou

Re: converting a nested try/except statement into try/except/else

2006-08-10 Thread Boris Borcic
Slawomir Nowaczyk wrote: > > try: > if int(text) > 0: >return True > except ValueError: > pass > self.error_message() > return False > Nicely DRY. To make it even more compact, it may be noticed that the default return value None is false in a boolean context - so that the last

Re: converting a nested try/except statement into try/except/else

2006-08-10 Thread Slawomir Nowaczyk
On Thu, 10 Aug 2006 14:32:49 + (GMT) John Salerno <[EMAIL PROTECTED]> wrote: #> Bruno Desthuilliers wrote: #> #> > try: #> > if int(text) <= 0: raise ValueError #> #> Hmm, I'm actually not so sure about this line now. It doesn't seem right #> to raise a ValueError when the res

Re: win32 load icon not from file, but from

2006-08-10 Thread Simon Forman
GHUM wrote: > I have found a "make a icon in traybar" skript, and it loads its Icon > from a file > > hinst = win32gui.GetModuleHandle(None) > iconPathName= "c:/myapp/myapp.ico" > icon_flags = win32con.LR_LOADFROMFILE | win32con.LR_DEFAULTSIZE > hicon = win32gui.LoadImage(hinst, str(iconPathName),

Re: Client/Server Question

2006-08-10 Thread diffuser78
I apologize. subprocess did work for me like a charm I made a mistake in my code. Appreciate your help. Dennis Benzinger wrote: > os.system() blocks until the called program has finished. Use the > subprocess module : > > > > import subprocess >

Re: seaching a list...

2006-08-10 Thread Simon Forman
bruce wrote: > hi... > > i'm playing with a test sample. i have somethhing like: > dog = mysql_get(.) > . > . > . > > such that 'dog' will be an 'AxB' array of data from the tbls What's an "'AxB' array", do you mean a list of lists? If not, what kind of object do you mean and what methods

Re: converting a nested try/except statement into try/except/else

2006-08-10 Thread Bruno Desthuilliers
John Salerno a écrit : > Bruno Desthuilliers wrote: > >> try: >> if int(text) <= 0: raise ValueError > > > Hmm, I'm actually not so sure about this line now. It doesn't seem right > to raise a ValueError when the result of the expression is negative, > because even though it's a

"running" code on client side with cherrypy?

2006-08-10 Thread Mr BigSmoke
Hi All, I'm developing a website to handle some code/application version control on a intranet. I'm using cherrypy and pysvn. Everything runs quite good but i want the user to be able to checkout some projects from the server. The user(on the client side) selects a folder in his machine (i.e.: C:\P

Re: converting a nested try/except statement into try/except/else

2006-08-10 Thread infidel
> > try: > > if int(text) <= 0: raise ValueError > > Hmm, I'm actually not so sure about this line now. It doesn't seem right > to raise a ValueError when the result of the expression is negative, > because even though it's a problem for my program, it isn't really a > "ValueError," r

Re: How to execute a file outside module's namespace?

2006-08-10 Thread Slawomir Nowaczyk
On Fri, 11 Aug 2006 01:23:14 +0800 Angelo Zhou <[EMAIL PROTECTED]> wrote: #> Slawomir Nowaczyk wrote: #> > Hello, #> > #> > Let's say I have a module "emacs", defining function eexecfile(file): #> > #> > def eexecfile(file): #> > # do other stuff #> > execfile(file,globals()) #> > #

Re: easy string formating question

2006-08-10 Thread Slawomir Nowaczyk
On Thu, 10 Aug 2006 11:39:41 -0700 f pemberton <[EMAIL PROTECTED]> wrote: #> I have kind of an interesting string, it looks like a couple hundred #> letters bunched together with no spaces. Anyway, i'm trying to put a #> "?" and a (\n) newline after every 100th character of the string and #> the

Re: easy string formating question

2006-08-10 Thread [EMAIL PROTECTED]
here's a simple way numChar = 10 testText="akfldjliugflkjlsuagjlfnflgj" for c in xrange(0,len(testText),numChar): print testText[c,c+numChar] for slightly better performance you should probably do numChar = 10 testText="akfldjliugflkjlsuagjlfnflgj" lenText = len(testText) for c in xrange(0,le

Re: draw an image in wx.BufferedDC onto the page created by AddPage of wx.Notebook

2006-08-10 Thread Simon Forman
zxo102 wrote: > Hi everyone, >I have tried two days to figure out how to draw the image in > wx.BufferedDC on the page created by AddPage of wx.Notebook but still > got no clue. > >The attached example works fine. If I click the menu "Draw" --> "New > Drawing". The image with wx.BufferedDC/

Re: using python to edit a word file?

2006-08-10 Thread John Salerno
John Salerno wrote: > But if I save the file to text, won't it lose its formatting? It looks like I can save it as an XML file and it will retain all the formatting. Now I just need to decipher where the dates are in all that mess and replace them, just using a normal text file! :) -- http://m

Re: reading from sockets

2006-08-10 Thread Simon Forman
AndrewTK wrote: > Hello, > > I'm trying to read data from a socket and I'm not seeing what I'm > expecting it seems to skip the first line of data. I am new to > Python and just trying to test what I can do with it... and it's not > looking pretty. > > > I have some Python code: > [

Re: Client/Server Question

2006-08-10 Thread diffuser78
> The recv() might return "MaxiSimDriving Sim". It could return > "MaxiS" on one call, and "im" on the next. If the remote side > closes the connection, recv() will keep returning the empty > string, and your program will be stuck in an infinite loop. How to overcome this problem ? > Did you und

Re: easy string formating question

2006-08-10 Thread Tim Chase
> I have kind of an interesting string, it looks like a couple hundred > letters bunched together with no spaces. Anyway, i'm trying to put a > "?" and a (\n) newline after every 100th character of the string and > then write that string to a file. How would I go about doing that? Any > help woul

Re: using python to edit a word file?

2006-08-10 Thread Gerhard Fiedler
On 2006-08-10 15:15:34, John Salerno wrote: > I figured my first step is to install the win32 extension, which I did, > but I can't seem to find any documentation for it. A couple of the links > on Mark Hammond's site don't seem to work. > > Anyway, all I need to do is search in the Word docume

Re: using python to edit a word file?

2006-08-10 Thread John Salerno
Rob Wolfe wrote: > John Salerno <[EMAIL PROTECTED]> writes: > >> I figured my first step is to install the win32 extension, which I >> did, but I can't seem to find any documentation for it. A couple of >> the links on Mark Hammond's site don't seem to work. >> >> Anyway, all I need to do is searc

seaching a list...

2006-08-10 Thread bruce
hi... i'm playing with a test sample. i have somethhing like: dog = mysql_get(.) . . . such that 'dog' will be an 'AxB' array of data from the tbls furher in the test app, i'm going to have a list, foo: foo = 'a','b','c','d' i'm trying to determine what's the fastest way of searching t

easy string formating question

2006-08-10 Thread f pemberton
I have kind of an interesting string, it looks like a couple hundred letters bunched together with no spaces. Anyway, i'm trying to put a "?" and a (\n) newline after every 100th character of the string and then write that string to a file. How would I go about doing that? Any help would be much

  1   2   3   >