Re: Dynamic HTML from Python Script

2008-06-10 Thread Larry Bates
asdf wrote: I have a python script whose output i want to dynamically display on a webpage which will be hosted using Apache. How do I do that? thanks Take a look at Django. It may be overkill for this first project but any time you spend learning it should be paid back in future projects.

Re: Producer-consumer threading problem

2008-06-10 Thread Larry Bates
George Sakkis wrote: I'd like some feedback on a solution to a variant of the producer- consumer problem. My first few attempts turned out to deadlock occasionally; this one seems to be deadlock-free so far but I can't tell if it's provably correct, and if so, whether it can be simplified. The g

Re: Producer-consumer threading problem

2008-06-11 Thread Larry Bates
George Sakkis wrote: On Jun 10, 11:47 pm, Larry Bates <[EMAIL PROTECTED]> wrote: I had a little trouble understanding what exact problem it is that you are trying to solve but I'm pretty sure that you can do it with one of two methods: Ok, let me try again with a different example

Re: python screen scraping/parsing

2008-06-14 Thread Larry Bates
Dan Stromberg wrote: BeautifulSoup is a pretty nice python module for screen scraping (not necessarily well formed) web pages. On Fri, 13 Jun 2008 11:10:09 -0700, bruce wrote: Hi... got a short test app that i'm playing with. the goal is to get data off the page in question. basically, i sh

Re: Platform independent code?

2008-06-14 Thread Larry Bates
saneman wrote: I have read that Python is a platform independent language. But on this page: http://docs.python.org/tut/node4.html#SECTION00422 it seems that making a python script executable is platform dependant: 2.2.2 Executable Python Scripts On BSD'ish Unix systems, Pyth

Re: Python + RDBM framework?

2008-06-14 Thread Larry Bates
bukzor wrote: It seems that whenever I have an application that uses a database (MySQL) I end up writing a database framework from scratch. Is there some accepted pre-existing project that has done this? I see Django, but that seems to have a lot of web-framework that I don't (necessarily) need.

Re: os.walk Value Error?

2008-06-14 Thread Larry Bates
[EMAIL PROTECTED] wrote: Hi, I'm using os.walk as follows: (basedir, pathnames, files) = os.walk("results", topdown=True) and I'm getting the error: ValueError: too many values to unpack From my googling, that means: This is the standard message when Python tries to unpack a tuple into fewe

Re: Zipping python modules

2008-06-16 Thread Larry Bates
Brian Vanderburg II wrote: I've installed Python 2.5 on MSW and it works. I'm preparing it to run from a thumb drive so I can run applications by dropping them onto the python.exe or from command line/etc. It works but the size is quite large. I've compressed most of the executables with UPX

Re: py2exe 0.6.8 released

2008-06-16 Thread Larry Bates
7;s the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php Everyone, Thanks for all your hard work on py2exe, it is greatly appreciated. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: 'string'.strip(chars)-like function that removes from the middle?

2008-06-16 Thread Larry Bates
Ethan Furman wrote: Greetings. The strip() method of strings works from both ends towards the middle. Is there a simple, built-in way to remove several characters from a string no matter their location? (besides .replace() ;) For example: .strip --> 'www.example.com'.strip('cmowz.') 'example'

Re: go to specific line in text file

2008-06-18 Thread Larry Bates
Patrick David wrote: Hello NG, I am searching for a way to jump to a specific line in a text file, let's say to line no. 9000. Is there any method like file.seek() which leads me to a given line instead of a given byte? Hope for help Patrick Others have given the general answer (No), but if y

Re: converting a text file to image

2008-06-20 Thread Larry Bates
jimgardener wrote: i am looking for python code to convert a textfile(.txt) to an image(preferrably Tiff).I believe it involves some scanning and conversion using some font table and probably compression using huffman encoding..is there an open source code doing this?can someone give a pointer?

Re: Storing value with limits in object

2008-06-22 Thread Larry Bates
Josip wrote: I'm trying to limit a value stored by object (either int or float): class Limited(object): def __init__(self, value, min, max): self.min, self.max = min, max self.n = value def set_n(self,value): if value < self.min: # boundary check self.

Re: Question: How do I format printing in python

2008-06-23 Thread Larry Bates
[EMAIL PROTECTED] wrote: Hi All, How do I format printed data in python? I could not find this in the Python Reference Manual: http://docs.python.org/ref/print.html Nor could I find it in Matloff's great tutorial: http://heather.cs.ucdavis.edu/~matloff/Python/PythonIntro.pdf For example, how d

Re: 32-bit python memory limits?

2008-06-23 Thread Larry Bates
Gary Robinson wrote: I'm running a Python job on OS X 10.5.3 and the Python 2.5.2 that's available as a binary download at python.org for OS X. I ran a python program tonight that ended up using much more memory than anticipated. It just kept on using more and more memory. Instead of killing i

Re: sending executable data over network..

2008-06-25 Thread Larry Bates
Cédric Lucantis wrote: Le Tuesday 24 June 2008 08:59:40 Piyush Anonymous, vous avez écrit : hi, i wish to change the way the function definition at run time in a running server. new function code which is to be executed is provided by a client at different location. i am getting it by reading a

Re: reading from list with paths

2008-06-25 Thread Larry Bates
antar2 wrote: Hello, Suppose this is a stupid question, but as a python beginner I encounter a lot of obstacles... so I would be very grateful with some help for following question: I would like to read files, of which the complete filepaths are mentioned in another textfile. In this textfile (

Re: Communication between Python and PHP

2008-06-25 Thread Larry Bates
nicodotti2 wrote: Don't ask me why, but we have a bunch of legacy code in PHP on a server and a wee-bit of Python code for integrating GData google calendar services. We now need to build a way of sending messages between them. The general flow is: PHP Web Page(on apache) ---> Python Gdata Consu

Re: Working with the Windows Registry

2008-06-25 Thread Larry Bates
teh_sAbEr wrote: Hi everybody. I'm trying to write a script that'll change desktop wallpaper every time its run. Heres what I've gotten so far: #random wallpaper changer! import _winreg from os import walk from os.path import exists from random import randint #first grab a registry handle. hand

Re: python interface to Firefox and Thunderbird

2008-06-26 Thread Larry Bates
yardennis wrote: Hi, I need python moudles that can auto install python 2.5 (web install or a EXE file) auto download and install Firefox3 and Thunderbird 2 auto import from IE 6, 7 and OE 5,6 and Outlook read contacts and emails from Thunderbird store read Firefox 3 bookmarks, history, cooki

Re: shorten path to files

2008-06-27 Thread Larry Bates
cesco wrote: Hi, I need to retrieve the content of some files which are placed on a network drive so in order to open them I need the full path to the file. Unfortunately some times the path is longer than 256 characters and in Windows such a path is too long with the result that the file is not

Re: HTML Parsing

2008-06-30 Thread Larry Bates
[EMAIL PROTECTED] wrote: Hi everyone I am trying to build my own web crawler for an experiement and I don't know how to access HTTP protocol with python. Also, Are there any Opensource Parsing engine for HTML documents available in Python too? That would be great. Check on Mechanize. It wraps

Re: windows installers and license agreement

2008-06-30 Thread Larry Bates
Darren Dale wrote: Is it possible to create a windows installer using distutils that includes a prompt for the user to agree to the terms of the license? Thanks, Darren If you are going to be creating windows installers, take a look at Inno Setup. It is way easier and more flexible than just

Re: List Performance

2008-06-30 Thread Larry Bates
Peter Otten wrote: Ampedesign wrote: If I happen to have a list that contains over 50,000 items, will the size of the list severely impact the performance of appending to the list? No. $ python -m timeit -n2 -s"items = []" "items.append(42)" 2 loops, best of 3: 0.554 usec per loop $

Re: The Yield statement

2008-06-30 Thread Larry Bates
Alex Bryan wrote: Okay, so i don't really understand the Yield thing and i know it is useful. I've read a few things about it but it is all programming jargon and so basically it is hard for me to understand. So can anyone give me a description or link me to a site that has a good definition an

Re: Functions associated with a class.

2008-06-30 Thread Larry Bates
Kurda Yon wrote: Hi, I start to learn the object oriented programing in Python. As far as I understood, every class has a set of corresponding methods and variables. For me it is easy to understand a method as a one-argument function associated with a class. For example, if I call "x.calc" and "

Re: Convert string to char array

2008-07-01 Thread Larry Bates
Brandon wrote: How do I convert a string to a char array? I am doing this so I can edit the string received from an sql query so I can remove unnecessary characters. The precise answer is: >>> s = 'abcdefghi' >>> l = list(s) >>> l ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'] >>> But qui

Re: Most efficient way to get pixelcolors of an image?

2008-07-02 Thread Larry Bates
defn noob wrote: i want to process a large number of images and store their respective pixels in a matrix. what is the mostt efficient way of opening and checking them? i doubt pygame is made for this purpose :) i guess i could also use tkinter? and why cant i print out matrix after getting t

Re: Instance Names

2008-07-03 Thread Larry Bates
Tim Cook wrote: Hi All, I have a need (if at all possible) to create instance names using '[' and ']', i.e. [at]=ClassA0(), [at0001]=ClassB2(), etc. Of course Python tries to unpack a sequence when I do that. Is there anyway to do this? I do have a workaround but it is an ugly, nasty URL

Re: Instance Names

2008-07-03 Thread Larry Bates
Tim Cook wrote: On Thu, 2008-07-03 at 14:20 -0500, Larry Bates wrote: I suspect there is some "misunderstanding" here. Why exactly do you think you need to have your instances named with [] characters in them? I often misunderstand. :-) But, I am implementing specifications

Re: How to bypass Windows 'cooking' the I/O? (One more time, please)

2008-07-03 Thread Larry Bates
norseman wrote: I know I saw the answer recently, as in since February '08, but I can't re-find it. :( I tried the mail archives and such and my own collections but the piece I saw still eludes me. Problem: (sos=same old s...) Microsoft insists the world work it's way even when the Mi

Re: compatible image type

2008-07-04 Thread Larry Bates
gordon wrote: hi in my application a file selection by user returns a pathname string like F:/images/png/my.png or F:/docs/text/somedoc.txt etc. I can get the extension using extn=string.split(os.path.basename(pathname),'.' )[1] then later on i want to create a Photoimage using ImageTk.Pho

Re: Is there a good way to implement file updating? such as lock, update, reload...

2008-07-07 Thread Larry Bates
Evan wrote: If I get rid of the XML, I have to change my script more and more, it is not easy to do that. :( :( Thanks, It is even harder to write a multi-user XML database (which is what you are wanting). Put the data in a multi-user database and convert to XML as needed. -Larry -- http:/

Re: Memory error while saving dictionary of size 65000X50 using pickle

2008-07-07 Thread Larry Bates
Nagu wrote: I am trying to save a dictionary of size 65000X50 to a local file and I get the memory error problem. How do I go about resolving this? Is there way to partition the pickle object and combine later if this is a problem due to limited resources (memory) on the machine (it is 32 bit ma

Re: plugins using cvs/distutils?

2008-07-08 Thread Larry Bates
Deacon wrote: Hi. I have an open-source application development environment that I would like to enable an automated package download system for (like downloadable plugins), using sourceforge as its repository. My software will have a menu-based popup window, that will list the packages (Applicat

Re: FOSS projects exhibiting clean/good OOP?

2008-07-09 Thread Larry Bates
Phillip B Oldham wrote: I'm wondering whether anyone can offer suggestions on FOSS projects/ apps which exhibit solid OO principles, clean code, good inline documentation, and sound design principles? I'm devoting some time to reviewing other people's code to advance my skills. Its good to revie

Re: Determining when a file has finished copying

2008-07-09 Thread Larry Bates
writeson wrote: Hi all, I'm writing some code that monitors a directory for the appearance of files from a workflow. When those files appear I write a command file to a device that tells the device how to process the file. The appearance of the command file triggers the device to grab the origin

Re: User-defined exception: "global name 'TestRunError' is not defined"

2008-07-09 Thread Larry Bates
[EMAIL PROTECTED] wrote: I'm using some legacy code that has a user-defined exception in it. The top level program includes this line from TestRunError import * It also imports several other modules. These other modules do not explicitly import TestRunError. TestRunError is raised in various

Re: Determining when a file has finished copying

2008-07-09 Thread Larry Bates
writeson wrote: Guys, Thanks for your replies, they are helpful. I should have included in my initial question that I don't have as much control over the program that writes (pgm-W) as I'd like. Otherwise, the write to a different filename and then rename solution would work great. There's no wa

Re: formatting list -> comma separated (slightly different)

2008-07-09 Thread Larry Bates
Michiel Overtoom wrote: Paul & Robert wrote... d = ["soep", "reeds", "ook"] print ', '.join(d) soep, reeds, ook I occasionally have a need for printing lists of items too, but in the form: "Butter, Cheese, Nuts and Bolts". The last separator is the word 'and' instead of the comma. The cleare

Re: Python equivalent of call/cc?

2008-07-09 Thread Larry Bates
The Pythonista wrote: Yesterday, I was hacking around a bit, trying to figure out how to implement the semantics of call/cc in Python. Specifically, I wanted to translate this Scheme code to equivalent Python: (define theContinuation #f) (define (test) (let ((i 0)) (call/cc

Re: Terminate a python script from linux shell / bash script

2008-07-09 Thread Larry Bates
Gros Bedo wrote: Hello :-) I have a question about Python and Linux shell. I have a python program which is permanently resident in the end-user system. I'm currently producing a RPM package, and it works nicely. The problem is that when I uninstall it, my program keeps running in the backgro

Re: Manipulating bitsets in struct

2008-07-09 Thread Larry Bates
Allen wrote: I'm using Python to do some simple network programming, and found the struct module very useful for such things, but is there a way to easily manipulate bitsets such as a 16 bit word being split into 4 parts like 2 bits, 1 bit, 4 bits, and 9 bits? Perhaps something like: struct.

Re: Determining when a file has finished copying

2008-07-09 Thread Larry Bates
keith wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ethan Furman wrote: writeson wrote: Guys, Thanks for your replies, they are helpful. I should have included in my initial question that I don't have as much control over the program that writes (pgm-W) as I'd like. Otherwise, the writ

Re: python scalability

2008-07-10 Thread Larry Bates
Tim Mitchell wrote: Hi All, I work on a desktop application that has been developed using python and GTK (see www.leapfrog3d.com). We have around 150k lines of python code (and 200k+ lines of C). We also have a new project manager with a C# background who has deep concerns about the scalabi

Re: Loading just in time

2008-07-10 Thread Larry Bates
D'Arcy J.M. Cain wrote: I am trying to create a utility module that only loads functions when they are first called rather than loading everything. I have a bunch of files in my utility directory with individual methods and for each I have lines like this in __init__.py: def calc_tax(*arg, **na

Re: Can anyone suggest a date peocedure...

2008-07-10 Thread Larry Bates
RV wrote: On Thu, 10 Jul 2008 13:39:29 -0700, Gary Herron <[EMAIL PROTECTED]> wrote: The datetime module has what you need. It has methods (with examples) on building a datetime object from a string, and it has a object named timedelta, and the ability to subtract a timedelta from a time.

Re: Beginner Question : Iterators and zip

2008-07-12 Thread Larry Bates
[EMAIL PROTECTED] wrote: Hi group, I have a basic question on the zip built in function. I am writing a simple text file comparison script, that compares line by line and character by character. The output is the original file, with an X in place of any characters that are different. I have ma

Re: Determining when a file has finished copying

2008-07-12 Thread Larry Bates
Sean DiZazzo wrote: On Jul 9, 5:34 pm, keith <[EMAIL PROTECTED]> wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ethan Furman wrote: writeson wrote: Guys, Thanks for your replies, they are helpful. I should have included in my initial question that I don't have as much control over the

Re: About wmi

2008-07-13 Thread Larry Bates
patrol wrote: I want to prevent some process from running. The code is in the following. I encounter some unexpected troubles. Probelm1: This program cannot terminate "scrcons.exe" and "FNPLicensingService.exe",which are system processes. Problem2:After a while, this program will abort by error

logging via SocketHandler and TCPserver

2008-07-13 Thread Larry Bates
Every time I look at the logging module (up until now) I've given up and continue to use my home-grown logger that I've been using for years. I'm not giving up this time ;-) I find that I REALLY need to be able to monitor LOTS of running programs/processes and thought it would be nice to hav

Re: Dictionary bidirectional

2008-07-13 Thread Larry Bates
[EMAIL PROTECTED] wrote: bukzor: You need to use two dictionaries. Here's a class that someone's written that wraps it up into a single dict-like object for you: http://www.faqts.com/knowledge_base/view.phtml/aid/4376 It contains code like: try: del self.data[item] except KeyError: pa

Re: How to package a logging.config file?

2008-07-13 Thread Larry Bates
Matthew Wilson wrote: I'm working on a package that uses the standard library logging module along with a .cfg file. In my code, I use logging.config.fileConfig('/home/matt/mypackage/matt.cfg') to load in the logging config file. However, it seems really obvious to me that this won't work when

Re: while var, but var ==16 != true

2008-07-13 Thread Larry Bates
maestro wrote: why does this work? "while p" = "while p != 0" ? 1 is True and 0 is false in python but other numbers have no boolean value so why doesnt it abort. p=16 p 16 while p: print p p -= 1 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 i can also do: k=[] while k:

Re: About wmi

2008-07-13 Thread Larry Bates
patrol wrote: > On 7月13日, 下午10时26分, Larry Bates <[EMAIL PROTECTED]> wrote: >> patrol wrote: >>> I want to prevent some process from running. The code is in the >>> following. I encounter some unexpected troubles. >>> Probelm1: This

Re: logging via SocketHandler and TCPserver

2008-07-14 Thread Larry Bates
Vinay Sajip wrote: On Jul 13, 9:25 pm, Larry Bates <[EMAIL PROTECTED]> wrote: Every time I look at theloggingmodule (up until now) I've given up and continue to use my home-grown logger that I've been using for years. I'm not giving up this time ;-) I find that I REAL

Re: Is it possible to create "network conneciton" on windows system?

2008-07-14 Thread Larry Bates
Evan wrote: Hello, one of my PC is window system, and in "control panel -> Network Connections", I can see some network connections such as PPPOE or VPN which I created by click "create a new connection". My question is, is it possible to create a new connection by using Python script? which me

Re: Using Python To Launch Python

2008-07-14 Thread Larry Bates
aha wrote: Hello All, I have a situation where I can count on a Python installation being available on a system, but I can't count on it being a version of Python needed by my application. Since my application has it's own version of Python installed with it how should I use the system Python

Re: Method behavior for user-created class instances

2008-07-14 Thread Larry Bates
[EMAIL PROTECTED] wrote: Greetings. I am looking for a way to achieve method behavior for a class I created. That is, it has a __call__ method, so can be called like a function. But I also want it to be treated as a method when it appears in a class body. Eg. class foo: def __call__(self,

Re: Is it possible to create "network conneciton" on windows system?

2008-07-14 Thread Larry Bates
Evan wrote: On Jul 15, 6:22 am, Larry Bates <[EMAIL PROTECTED]> wrote: Evan wrote: Hello, one of my PC is window system, and in "control panel ->Network Connections", I can see somenetworkconnectionssuch as PPPOE or VPN which I created by click "create a new connection

Re: One step up from str.split()

2008-07-14 Thread Larry Bates
Joel Koltner wrote: I normally use str.split() for simple splitting of command line arguments, but I would like to support, e.g., long file names which-- under windows -- are typically provided as simple quoted string. E.g., myapp --dosomething --loadthis "my file name.fil" ...and I'd like t

Re: logging via SocketHandler and TCPserver

2008-07-15 Thread Larry Bates
Vinay Sajip wrote: On Jul 14, 11:16 pm, Larry Bates <[EMAIL PROTECTED]> wrote: Vinay, Thanks for your detailed explanation, but IMHO your suggested solution is almost the opposite (right idea wrong direction) of what I'm looking for. Hypothetical setup: a

Re: Python internals

2008-07-15 Thread Larry Bates
Peter Anderson wrote: Hi! I am slowly teaching myself Python. I was reading David Beazley's excellent book "Python - Essential Reference"; in particular about variables. Let me quote: "Python is a dynamically typed language in which names can represent values of different types during the

Re: 'if name is not None:' v. 'if name:'

2008-07-15 Thread Larry Bates
Victor Noagbodji wrote: Hello, what's the difference between these two statement? And which one should one use? if name ... Will be false if: name is an integer == 0 name is a float == 0 name is an empty string name is an empty list name is an empty dictionary There are others, but you get

Re: graphing lifelines

2008-07-15 Thread Larry Bates
E. J. Gold is the Hi-Tech Shaman wrote: (crossposted to sci.math) I'm looking for a tool which will take a dataset of tuples indicating the year of birth and death of a person: (1872, 1950, "Sri Aurobindo") (1821, 1910, "Mary Baker Eddy") (1831, 1891, "HP. Blavatksy") And graph them out, in ba

Re: logging via SocketHandler and TCPserver

2008-07-15 Thread Larry Bates
Rob Wolfe wrote: Larry Bates <[EMAIL PROTECTED]> writes: Can multiple applications send SocketHandler logging records to the same socket server on the same port simultaneously? Of course they can. Server can accept requests from many clients. You have used `SocketServer.ThreadingTCP

Re: Testing for connection to a website

2008-07-15 Thread Larry Bates
Alexnb wrote: Okay, I already made this post, but it kinda got lost. So anyway I need to figure out how to test if the user is able to connect to a specific website. Last time I got pointed to the urllib2 page, but if I do urlopen() and and am not connected, the program stops. So I don't know if

Re: How to figure out if the platform is 32bit or 64bit?

2008-07-15 Thread Larry Bates
[EMAIL PROTECTED] wrote: I need to know if I'm running on 32bit or 64bit ... so far I haven't come up with how to get this info via python. sys.platform returns what python was built on ... but not what the current system is. I thought platform.uname() or just platform.processor() would have don

Re: Python internals

2008-07-15 Thread Larry Bates
Ben Finney wrote: Larry Bates <[EMAIL PROTECTED]> writes: Names are pointers in Python that point to values in memory. The term "pointer" carries much extra baggage for a programmer thinking of C (as the original poster is). Python names give no access to the "addre

Re: Modify a string's value

2008-07-15 Thread Larry Bates
[EMAIL PROTECTED] wrote: Hi everyone, I've heard that a 'str' object is immutable. But is there *any* way to modify a string's internal value? Thanks, Sebastian Why would you care? Just create a new string (with the changed contents) and let garbage collection take care of the old one when

Re: How to figure out if the platform is 32bit or 64bit?

2008-07-15 Thread Larry Bates
David Lees wrote: [EMAIL PROTECTED] wrote: I need to know if I'm running on 32bit or 64bit ... so far I haven't come up with how to get this info via python. sys.platform returns what python was built on ... but not what the current system is. I thought platform.uname() or just platform.process

Re: graphing lifelines

2008-07-15 Thread Larry Bates
E. J. Gold is the Hi-Tech Shaman wrote: On Jul 15, 3:38 pm, Larry Bates <[EMAIL PROTECTED]> wrote: Certainly a "Hi-Tech Shaman" can whip something up to do this, right? Yes, well E.J. Gold is the Hi-Tech Shaman. I'm Terrence Brannon, stating that fact :) So, maybe EJ

Re: Best Python packages?

2008-07-16 Thread Larry Bates
Ben Sizer wrote: Although the standard library in Python is great, there are undoubtedly some great packages available from 3rd parties, and I've encountered a few almost by accident. However, I don't know how a user would become aware of many of these. http://pypi.python.org/pypi/ presumably lis

Re: Framework recommendations for web service?

2008-07-16 Thread Larry Bates
Phillip B Oldham wrote: We're looking at the next phase of development for our webapp, and the main focus will be to move the core from the app to a web service so other systems can use the data we've gathered (we're thinking along the lines of the XML API of Highrise from 37Signals). Its possib

Re: py2exe issues with pictures and icons

2008-07-16 Thread Larry Bates
Alexnb wrote: Hello I am sure most of you are familiar with py2exe. I am having a bit of a problem. See the program has a few pictures involved and the .ico it uses for the windows. However, the pictures are stored in the same directory as the source, something like: C:\Docs and settings\me\My d

Re: create instance attributes for every method argument

2008-07-19 Thread Larry Bates
Berco Beute wrote: I remember reading somewhere how to create an instance attribute for every method argument, but although Google is my friend, I can't seem to find it. This could likely be done way more elegant: = class Test(object): def __init__(self, a, b, c, d,

Re: Run as Service

2008-07-21 Thread Larry Bates
[EMAIL PROTECTED] wrote: I have, in the past, used SRVANY to run a Python app as a Windows service. However, now I am interested in distributing my scripts and want to make it as painless for the end user as possible (hands-off is best :). How can you go about running a Python app as a Windows

Re: Please recommend a RPC system working with twisted.

2008-07-21 Thread Larry Bates
??? wrote: Hi all, I'm looking for an RPC system working with twisted. 1. Binary. I want it run faster than any xml based RPC. 2. Bidirectional. Unlike HTTP, on which the client has to poll the sever for events, the server should "call" the client's method to notify events. 3. C/Python sup

Re: how to create GUI dynamically

2008-07-21 Thread Larry Bates
[EMAIL PROTECTED] wrote: Hi; i m working on a project where i need run time creation of GUI. i have some no. of entities for which i want checkboxes in front of them which can be checked/ unchecked by user. But the problem is that the number and name of entities is not fixed and it depends on

Re: persistent deque (continued)

2008-07-21 Thread Larry Bates
castironpi wrote: Some time ago, I was asking about the feasibility of a persistent deque, a double-ended queue. It runs into the typical space allocation problems. If you're storing a pickle, you have to allocate and fragment the file you've opened, since pickles can be variable-length strings

Re: Trying to solve a python/mechanize "error 500" http error

2008-07-21 Thread Larry Bates
bruce wrote: i'm getting the following error: mechanize._response.httperror_seek_wrapper: HTTP Error 500: i'm running python 5.1 and mechanize 0.1.7b I have no idea as to what I have to change/modify/include to handle this issue. The link that I'm testing is at the bottom of the page. W

Re: Python Written in C?

2008-07-21 Thread Larry Bates
[EMAIL PROTECTED] wrote: I'm just learning about Python now and it sounds interesting. But I just read (on the Wiki page) that mainstream Python was written in C. That's what I was searching for: Python was written in what other language? See, my concern was something like: OK, if Python is so h

Re: Website Creation using Python

2008-07-21 Thread Larry Bates
Amie wrote: Afternoon, I would like some help on how to create a website using the python programming language. I've tried using enamel, but had some problems because I could not create html tables and intergrating it with python, like you use it when coding in php. Any help would be appreciate

Re: Python Written in C?

2008-07-21 Thread Larry Bates
Grant Edwards wrote: On 2008-07-22, Larry Bates <[EMAIL PROTECTED]> wrote: You talk about "writing it in assembly language for each MPU chip". Actually it is even better than that. We now have these modern inventions, called compilers that do that type of work for us. The

Re: Authentication for XML-RPC Calls

2008-07-22 Thread Larry Bates
whitemice wrote: The only documentation regarding doing authentication for XML-RPC I can find is - "Both the HTTP and HTTPS transports support the URL syntax extension for HTTP Basic Authentication: http://user:[EMAIL PROTECTED]:port/path. The user:pass portion will be base64-encoded as an HTTP

Re: Iterating Through List or Tuple

2008-07-22 Thread Larry Bates
Samir wrote: Is there a way to loop or iterate through a list/tuple in such a way that when you reach the end, you start over at the beginning? For example, suppose I define a list "daysOfWeek" such that: daysOfWeek = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturda

Re: How do I compare files?

2008-07-22 Thread Larry Bates
Clay Hobbs wrote: I am making a program that (with urllib) that downloads two jpeg files and, if they are different, displays the new one. I need to find a way to compare two files in Python. How is this done? -- Ratfink Use md5 to calculate checksum: import md5 md5file1 = md5.md5(open(fi

Re: Python Written in C?

2008-07-22 Thread Larry Bates
Grant Edwards wrote: On 2008-07-22, Larry Bates <[EMAIL PROTECTED]> wrote: Grant Edwards wrote: On 2008-07-22, Larry Bates <[EMAIL PROTECTED]> wrote: You talk about "writing it in assembly language for each MPU chip". Actually it is even better than that. We

Re: Python Written in C?

2008-07-22 Thread Larry Bates
Marc 'BlackJack' Rintsch wrote: On Mon, 21 Jul 2008 18:12:54 +0200, mk wrote: Seriously, though, would there be any advantage in re-implementing Python in e.g. C++? Not that current implementation is bad, anything but, but if you're not careful, the fact that lists are implemented as C array

Re: os.walk question

2008-07-23 Thread Larry Bates
Fredrik Lundh wrote: Lanny wrote: How would one make a list of the files in the top directory using os.walk. I need to pick a random file from said list. if you want a list of files from a single directory, use listdir, not walk: >>> import os, random >>> random.choice(os.listdir(

Re: object persistency, store instances relationship externally

2008-07-25 Thread Larry Bates
King wrote: This is a new test for object persistency. I am trying to store the relationship between instances externally. It's not working as expected. May be I am doing it in wrong way. Any suggestions? import shelve class attrib(object): pass class node(object): def __init__(self):

Re: Stripping parts of a path

2008-07-26 Thread Larry Bates
Tim Cook wrote: Hi All, I just ran into an issue with the rstrip method when using it on path strings. When executing a function I have a need to strip off a portion of the current working directory and add on a path to a log file. Initially this worked great but then I added a branch in SVN w

Re: Where is the correct round() method?

2008-07-27 Thread Larry Bates
josh logan wrote: Hello, I need a round function that _always_ rounds to the higher integer if the argument is equidistant between two integers. In Python 3.0, this is not the advertised behavior of the built-in function round() as seen below: round(0.5) 0 round(1.5) 2 round(2.5) 2 I wo

Re: write unsigned integer 32 bits to socket

2008-07-27 Thread Larry Bates
[EMAIL PROTECTED] wrote: hi i want to send unsigned 32 bit integer to socket, and looking for something equivalent to this method... http://livedocs.adobe.com/flex/2/langref/flash/net/Socket.html#writeUnsignedInt() is there such method / library available in python?! this is as far as i have

Re: write unsigned integer 32 bits to socket

2008-07-27 Thread Larry Bates
[EMAIL PROTECTED] wrote: On Sun, Jul 27, 2008 at 7:01 PM, Larry Bates <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] wrote: i want to send unsigned 32 bit integer to socket, and looking for something equivalent to this method... http://livedocs.adobe.com/flex/2/langref/flash/net/Socke

Re: We programming

2008-07-28 Thread Larry Bates
srinivasan srinivas wrote: Hi, Could someone suggest me better python modules for developing web programming related projects like web-pages download and uopload?? Thanks, Srini Explore your hobbies and interests. Go to http://in.promos.yahoo.com/groups/ urllib, urllib2, httplib All

Re: Suggestions for creating a PDF table

2008-07-28 Thread Larry Bates
Kirk Strauser wrote: Short question: Is there a good library for generating HTML-style tables with the equivalent of colspans, automatically sized columns, etc. that can render directly to PDF? Longer question: I'm re-doing a big chunk of locally-written code. I have a report-generating funct

Re: static variables in Python?

2008-07-29 Thread Larry Bates
kj wrote: Yet another noob question... Is there a way to mimic C's static variables in Python? Or something like it? The idea is to equip a given function with a set of constants that belong only to it, so as not to clutter the global namespace with variables that are not needed elsewhere. Fo

Re: Python COM

2008-07-29 Thread Larry Bates
[EMAIL PROTECTED] wrote: I have implemented a COM in C++,buy i don't know how to use this COM in python. For example: the COM's ProgID is "MyCOM1.AdvMethod".this COM have two interfaces,the default interface's name is IAdvMethod,the second interface's name is IBasicMethod. How do i use those inte

Re: Searching for some kind of data type

2008-08-02 Thread Larry Bates
Giampaolo Rodola' wrote: Hi, for an FTP server I wrote I'd need to group the FTP commands in one table that defines the command itself, the syntax string, required permission, whether it requires authorization, whether it takes argument and whether there's a need to validate the path from the arg

<    5   6   7   8   9   10   11   12   >