Re: Midi manipulation

2008-11-17 Thread Ken Starks
Massi wrote: On 16 Nov, 23:23, Tim Roberts [EMAIL PROTECTED] wrote: Massi [EMAIL PROTECTED] wrote: Hi everyone, I'm searching for something which allows me to write scripts which handle midi files. I'm totally a newbie in audio manipulation, therefore any suggestion or link related to this

Re: Midi manipulation

2008-11-17 Thread Ken Starks
Ken Starks wrote: Massi wrote: On 16 Nov, 23:23, Tim Roberts [EMAIL PROTECTED] wrote: Massi [EMAIL PROTECTED] wrote: Hi everyone, I'm searching for something which allows me to write scripts which handle midi files. I'm totally a newbie in audio manipulation, therefore any suggestion or link

Re: max(), sum(), next()

2008-09-06 Thread Ken Starks
castironpi wrote: On Sep 5, 9:20 pm, Manu Hack [EMAIL PROTECTED] wrote: On Fri, Sep 5, 2008 at 1:04 PM, castironpi [EMAIL PROTECTED] wrote: On Sep 5, 3:28 am, Manu Hack [EMAIL PROTECTED] wrote: On Thu, Sep 4, 2008 at 4:25 PM, castironpi [EMAIL PROTECTED] wrote: On Sep 4, 2:42 pm, [EMAIL

Re: max(), sum(), next()

2008-09-06 Thread Ken Starks
castironpi wrote: On Sep 5, 9:20 pm, Manu Hack [EMAIL PROTECTED] wrote: On Fri, Sep 5, 2008 at 1:04 PM, castironpi [EMAIL PROTECTED] wrote: On Sep 5, 3:28 am, Manu Hack [EMAIL PROTECTED] wrote: On Thu, Sep 4, 2008 at 4:25 PM, castironpi [EMAIL PROTECTED] wrote: On Sep 4, 2:42 pm, [EMAIL

Re: max(), sum(), next()

2008-09-05 Thread Ken Starks
David C. Ullrich wrote: In article [EMAIL PROTECTED], Mensanator [EMAIL PROTECTED] wrote: On Sep 3, 2:18 pm, Laszlo Nagy [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Empty Python lists [] don't know the type of the items it will contain, so this sounds strange: sum([]) 0 Because

Re: max(), sum(), next()

2008-09-05 Thread Ken Starks
David C. Ullrich wrote: I don't see why you feel the two should act the same. At least in mathematics, the sum of the elements of the empty set _is_ 0, while the maximum element of the empty set is undefined. And both for good reason: (i) If A and B are disjoint sets we certainly want to

Re: max(), sum(), next()

2008-09-05 Thread Ken Starks
David C. Ullrich wrote: In article [EMAIL PROTECTED], Ken Starks [EMAIL PROTECTED] wrote: David C. Ullrich wrote: I don't see why you feel the two should act the same. At least in mathematics, the sum of the elements of the empty set _is_ 0, while the maximum element of the empty set

Re: Writing to ms excel

2008-08-31 Thread Ken Starks
John Machin wrote: On Aug 31, 11:32 am, Marin Brkic [EMAIL PROTECTED] wrote: Is there a way to access google groups through a similiar interface program as a newsreader. I don't know (question has never arisen before). Never used them before, and getting a lot of messages to my email

Re: Writing to ms excel

2008-08-31 Thread Ken Starks
Marin Brkic wrote: snip ... lots Actually, that might work. What I was needing (aiming for) was a way to write to excel 2003 files. Formatting is not necessary, since what I'm trying to write is some tabular data; results from fortran-python simulation (I can explain, but the details seem

Re: How to check is something is a list or a dictionary or a string?

2008-08-30 Thread Ken Starks
George Sakkis wrote: On Aug 29, 12:16 pm, [EMAIL PROTECTED] wrote: Hi, How to check if something is a list or a dictionary or just a string? Eg: for item in self.__libVerDict.itervalues(): self.cbAnalysisLibVersion(END, item) where __libVerDict is a dictionary that holds values

Re: How to check is something is a list or a dictionary or a string?

2008-08-30 Thread Ken Starks
reimplemented (currently mostly in Python). Also, binary files use bytes instead of strings. * The StringIO and cStringIO modules are gone. Instead, import io.StringIO or io.BytesIO. * '\U' and '\u' escapes in raw strings are not treated specially. On Aug 30, 7:15 am, Ken Starks [EMAIL

Re: Writing to ms excel

2008-08-30 Thread Ken Starks
Marin Brkic wrote: Hello all, please, let me apologize in advance. English is not my first language (not even my second one), so excuse any errors with which I'm about to embarass myself in front of the general public. Second, I'm relatively new to python, so sorry if this seems like a stupid

Re: [1,2,3] exactly same as [1,2,3,] ?

2008-08-29 Thread Ken Starks
[EMAIL PROTECTED] wrote: x=[1,2,3] and x=[1,2,3,] are exactly the same, right? I'm generating some python data, and it's less error prone to not treat the last element specially, but I want to be sure I'm generating an equivalent data structure. Many TIA! Mark x=[1,2,3,] repr(x) [1,2,3]

Re: class definition syntax

2008-08-29 Thread Ken Starks
harryos wrote: hi i have seen some class definitions like class MyClass(object): def __init__(self): what does the object keyword inside the braces in MyClass() mean? Has it got any significance? thanks in advance harry It is a syntax used for 'new type' classes, not so new

Re: [Q] How to ignore the first line of the text read from a file

2008-08-28 Thread Ken Starks
[EMAIL PROTECTED] wrote: Hello, I am new to Python and have one simple question to which I cannot find a satisfactory solution. I want to read text line-by-line from a text file, but want to ignore only the first line. I know how to do it in Java (Java has been my primary language for the last

Re: Private attribute

2008-08-26 Thread Ken Starks
Steven D'Aprano wrote: snip def SomeClass(object): _gridsize = 0.8 The leading underscore tells callers that they change the attribute at their own risk. An even more Pythonic approach is to write your class that makes no assumptions about gridsize, and thus explicitly supports any

Private attribute

2008-08-25 Thread Ken Starks
I have a class with an attribute called 'gridsize' and I want a derived class to force and keep it at 0.8 (representing 8mm). Is this a correct, or the most pythonic approach? def __getattr__(self,attrname): if attrname == 'gridsize': return 0.8

Re: Private attribute

2008-08-25 Thread Ken Starks
Ken Starks wrote: I have a class with an attribute called 'gridsize' and I want a derived class to force and keep it at 0.8 (representing 8mm). Is this a correct, or the most pythonic approach? def __getattr__(self,attrname): if attrname == 'gridsize

Re: Private attribute

2008-08-25 Thread Ken Starks
André wrote: On Aug 25, 3:47 pm, Ken Starks [EMAIL PROTECTED] wrote: I have a class with an attribute called 'gridsize' and I want a derived class to force and keep it at 0.8 (representing 8mm). Is this a correct, or the most pythonic approach? def __getattr__(self

Re: Private attribute

2008-08-25 Thread Ken Starks
Marc 'BlackJack' Rintsch wrote: On Mon, 25 Aug 2008 21:44:49 +0100, Ken Starks wrote: def __getattr__(self,attrname): if attrname == 'gridsize': return 0.8 def __setattr__(self,attrname,value): if attrname == 'gridsize

Re: Filling in Degrees in a Circle (Astronomy)

2008-08-23 Thread Ken Starks
tom wrote: Both scipy and matplotlib are not part of the standard Python distribution so they would need to be installed separately. Scipy is useful for scientific data analysis, and matplotlib is useful for making plots. For a review of a really nice looking wrapper around lots of

Re: How do I organize my Python application code?

2008-08-14 Thread Ken Starks
Fredrik Lundh wrote: Dudeja, Rajat wrote: And my problem is that I don't have an understanding of how the code in Python is generally organized, in case my code spans multiple files, modules, etc. I've been using C/C++ althrough my life on Linux and Visaul Studio, so the way their code is

Re: You advice please

2008-08-13 Thread Ken Starks
Hussein B wrote: Hey, I'm a Java/Java EE developer and I'm playing with Python these days. I like the Python language so much and I like its communities and the Django framework. My friends are about to open a Ruby/Rails shop and they are asking me to join them. I don't know what, sure I'm not

Re: Looking out a module for Subversion

2008-08-12 Thread Ken Starks
Dudeja, Rajat wrote: Hi, I'm new to Python. I only have read Byte of Python by Swaroop C H just to be familiar with sytax of python. I've installed Python 2.5 from Active State and using its PythonWin Editor / interpreter. This, unfortunaltely, does not help in debugging. I'm looking for an

Re: Replace value of node using getElementsByTagName

2008-08-10 Thread Ken Starks
Ouray Viney wrote: Xml ib8.4.27.5/ib python from xml.dom import minidom xmldoc = minidom.parse('C:\TestProfile.xml') xmldoc ibNodeList = xmldoc.getElementsByTagName(ib) firstChild = xmldoc.firstChild for node in xmldoc.getElementsByTagName('ib'): # visit every node ib print

Re: Suggestions for creating a PDF table

2008-08-08 Thread Ken Starks
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

Re: Keg - A python web framework

2008-08-05 Thread Ken Starks
Daniel Fetchinson wrote: I've been working on a python web framework which I think might be of interest to you. Details may be found at http://code.google.com/p/keg/wiki/Concept. All suggestions or comments will be greatly appreciated. I fail to see what the advantages of your framework are

Re: Decimals not equalling themselves (e.g. 0.2 = 0.2000000001)

2008-08-04 Thread Ken Starks
CNiall wrote: I am very new to Python (I started learning it just yesterday), but I have encountered a problem. I want to make a simple script that calculates the n-th root of a given number (e.g. 4th root of 625--obviously five, but it's just an example :P), and because there is no nth-root

Re: derivative in numpy

2008-07-28 Thread Ken Starks
[EMAIL PROTECTED] wrote: Hi, I am looking to do a simple derivative. I would expect such a function to be available in numpy, but can't find it. I have written my own, but just curious if anybody knows of such function in numpy. Cheers, Kim numpy and much more are wrapped together in 'sage'

Re: derivative in numpy

2008-07-28 Thread Ken Starks
Ken Starks wrote: [EMAIL PROTECTED] wrote: Hi, I am looking to do a simple derivative. I would expect such a function to be available in numpy, but can't find it. I have written my own, but just curious if anybody knows of such function in numpy. Cheers, Kim numpy and much more are wrapped

Re: % sign in python?

2008-07-18 Thread Ken Starks
Terry Reedy wrote: korean_dave wrote: What does this operator do? Specifically in this context test.log( [[Log level %d: %s]] % ( level, msg ), description ) (Tried googling and searching, but the % gets interpreted as an operation and distorts the search results) Having seen a number of

Eclipse, Pydev, question

2008-07-16 Thread Ken Starks
I have a small project for further development in eclipse, using the pyDev plug-in. I am working on foo.py and bar.pyc is also in the directory. bar.py is not in the directory; it is someone else's (confidential) file, and I don't get the python source. Can I run bar.pyc from eclipse ? --

Re: Measure class, precision, significant digits, and divmod()

2008-07-15 Thread Ken Starks
Ethan Furman wrote: Hey all. snip As I have mentioned before, I am making this Measure class for two reasons: experience with unit testing, I like playing with numbers, I am unaware of anything like this having yet been done (okay, three reasons ;). snip Any and all feedback

Re: Dictionary bidirectional

2008-07-14 Thread Ken Starks
Dennis Lee Bieber wrote: On Sun, 13 Jul 2008 16:21:11 -0700 (PDT), Kless [EMAIL PROTECTED] declaimed the following in comp.lang.python: I need a dictionary where get the result from a 'key' (on left), but also from a 'value' (on right), how to get it? I know that dictionaries aren't

Re: PIL: Transparent PNGs and im.paste: ValueError: bad transparency mask

2008-07-11 Thread Ken Starks
Durand wrote: I posted this too soon. Converting the images to png with image magick's convert did the trick...However, I'm still not sure why I need to convert the images in the first place. Are there different types of PNGs?

Re: sage vs enthought for sci computing

2008-07-09 Thread Ken Starks
sturlamolden wrote: On 7 Jul, 22:35, [EMAIL PROTECTED] wrote: Hello, I have recently become interested in using python for scientific computing, and came across both sage and enthought. I am curious if anyone can tell me what the differences are between the two, since there seems to be a lot of

Re: python beginner

2008-07-07 Thread Ken Starks
cna wrote: Hi all and one, how may i learn python. is there any other website except python.org For several video series, follow the link from python.org to the ShowMeDo site. http://www.python.org/doc/av/5minutes/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting a path from a file object

2008-07-05 Thread Ken Starks
Andrew Fong wrote: Newbie question: Let's say I open a new file for writing in a certain path. How do I get that path back? Example: f = open('/some/path/file.ext') some_function(f) '/some/path/file.ext' Does some_function(f) already exist? And if not, how would I define it? -- Andrew

How do I unit-test a specific case of a home-rolled exception ?

2008-06-27 Thread Ken Starks
I'm a bit new to both home-made exceptions and unit tests, so sorry if I'm just being stupid or doing it totally wrong. I have an exception class, and I want to check that a particular instance of it has been raised; or more accurately that one is raised that is equal to an instance I specify.

Re: How do I unit-test a specific case of a home-rolled exception ?

2008-06-27 Thread Ken Starks
Peter Otten wrote: Ken Starks wrote: I have an exception class, and I want to check that a particular instance of it has been raised; or more accurately that one is raised that is equal to an instance I specify. In the example below, I can check that a 'LongRationalError' is raised, but I

Re: binary number format ? format character %b or similar.

2008-06-23 Thread Ken Starks
Mensanator wrote: On Jun 22, 4:07�pm, Ken Starks [EMAIL PROTECTED] wrote: weheh wrote: I don't know if you found this example: http://www.daniweb.com/code/snippet285.html Thanks for that. The offerings are very similar to the algorithms I wrote myself. It wasn't the solution I was after

binary number format ? format character %b or similar.

2008-06-22 Thread Ken Starks
I'm was wanting to format a positive integer in binary, and not finding it--to my surprise--I rolled my own version. Is this already in python, or have I missed it somewhere? I have Googled around a bit, and found a few threads on the subject, but they all seem to fizzle out. (e.g. : INPUT 35,

Re: binary number format ? format character %b or similar.

2008-06-22 Thread Ken Starks
weheh wrote: I don't know if you found this example: http://www.daniweb.com/code/snippet285.html Thanks for that. The offerings are very similar to the algorithms I wrote myself. It wasn't the solution I was after,really; that's easy. It was whether anything had found its way into the

Re: Most effective coding.. IDE question.

2008-06-08 Thread Ken Starks
dave wrote: Hello everyone, I'm a beginning self-taught python student. Currently, I work out my code within IDLE then when I have a version that I like, or that's working, I move it over to a new window and save it. I've been playing w/ Komodo IDE lately, and while it's nice, what I

Re: Interesting Math Problem

2008-06-05 Thread Ken Starks
BEES INC wrote: I've been awfully busy programming lately. My Django-based side project is coming along well and I hope to have it ready for use in a few weeks. Please don't ask more about it, that's really all I can say for now. Anyways, I came across an interesting little math problem today

Re: Writing HTML

2008-06-02 Thread Ken Starks
[EMAIL PROTECTED] wrote: I've searched the standard library docs, and, while there are a couple options for *reading* HTML from Python, I didn't notice any for *writing* it. Does anyone have any recommendations (particularly ones not listed on PyPI)? Thanks My approach is usually to write

Re: simple way to touch a file if it does not exist

2008-05-22 Thread Ken Starks
After os.path.exists, you need to check it _is_ a file, and not a directory. Giampaolo Rodola' wrote: On 22 Mag, 01:15, Nikhil [EMAIL PROTECTED] wrote: what are the simple ways? I could think of os.open(), os.exec(touch file) are there any simpler methods? Just use os.path.exists to check

Re: How do *you* use Python in non-GUI work?

2008-05-19 Thread Ken Starks
John Salerno wrote: Hey all. Just thought I'd ask a general question for my own interest. Every time I think of something I might do in Python, it usually involves creating a GUI interface, so I was wondering what kind of work you all do with Python that does *not* involve any GUI work. This

Re: addendum Re: working with images (PIL ?)

2008-05-19 Thread Ken Starks
I would still be concerned that you are checking against the percentage of the 768 bins returned by the histogram method. Two pixels of widely different colour end up in the same bin, so long as just ONE of the Red, Green, or Blue components is equal. So, for example, colours (2, 27, 200) and

Re: addendum Re: working with images (PIL ?)

2008-05-18 Thread Ken Starks
Oops. I meant: WhiteArea=Result.histogram()[255] of course, not WhiteArea=Result.histogram()[0] Ken Starks wrote: As others have said, PIL has the 'histogram' method to do most of the work. However, as histogram works on each band separately, you have a bit of preliminary programming first

Re: Write bits in file

2008-05-18 Thread Ken Starks
You want your file considered as a sequence of bits rather than a sequence of 8-bit bytes, do you? is the 10-bit bit-pattern to be stored at an arbitrary bit-position in the file, or is the whole file regularly subdivided at 10-bit intervals? Monica Leko wrote: Hi I have a specific format and

Re: Write bits in file

2008-05-18 Thread Ken Starks
: http://cobweb.ecn.purdue.edu/~kak/dist/BitVector-1.4.1.html Monica Leko wrote: On May 18, 2:20 pm, Ken Starks [EMAIL PROTECTED] wrote: You want your file considered as a sequence of bits rather than a sequence of 8-bit bytes, do you? Yes. is the 10-bit bit-pattern to be stored

Re: addendum Re: working with images (PIL ?)

2008-05-17 Thread Ken Starks
As others have said, PIL has the 'histogram' method to do most of the work. However, as histogram works on each band separately, you have a bit of preliminary programming first to combine them. The ImageChops darker method is one easy-to-understand way (done twice), but there are lots of

Authoring SOAP and WSDL

2008-05-10 Thread Ken Starks
I would like to write SOAP services in python, and have an environment that will then generate a matching WSDL for me automatically. Does such a thing exist in python? Thanks in advance. Ken. -- http://mail.python.org/mailman/listinfo/python-list

Re: Real Time Midi File Playback - Reading and Writing midi at the same time

2008-05-04 Thread Ken Starks
Gilly wrote: Hi I am trying to create an application that uses some form of input to create a midi file. I would like for this to be a 'real time' process. In other words, I want to be able to begin playing the midi file before I finish writing it, and continue writing as it plays. I would

UK Ordnance survey coordinates and Geocoding anyone ?

2007-07-29 Thread Ken Starks
Has anyone written a python wrapper around the (Windows) dll for converting between OSGB36 and ETRS89 coordinates ? The dll and an application are available from http://www.qgsl.co.uk as long as you register. Information, if you don't know what I'm taking about:

Re: Generate report containing pdf or ps figures?

2007-05-01 Thread Ken Starks
Cameron Laird wrote: In article [EMAIL PROTECTED], Grant Edwards [EMAIL PROTECTED] wrote: I need to be able to generate a PDF report which consists mostly of vector images (which I can generate as encapsulated Postscript, PDF, or SVG). What I need is a way to combine these figures into a

Re: help developing an editor to view openoffice files.

2007-03-13 Thread Ken Starks
krishnakant Mane wrote: hello, right now I am involved on doing a very important accessibility work. as many people may or may not know that I am a visually handicap person and work a lot on accessibility. the main issue at hand is to create an accessible editor for open office. there are a

Re: List of files to be opened

2006-01-26 Thread Ken Starks
yawgmoth7 wrote: Hello, I am currently writing a script that requires a few different files to be opened, and examined. What I need to be able to do is use something like: filelist = os.system(ls) Some way to open the file list and read each file one by one here I cannot think of a way

Re: Loading a Python collection from an text-file

2006-01-23 Thread Ken Starks
Ilias Lazaridis wrote: within a python script, I like to create a collection which I fill with values from an external text-file (user editable). How is this accomplished the easiest way (if possible without the need of libraries which are not part of the standard distribution)?

Re: ideas for university project ??

2005-08-28 Thread Ken Starks
Jon Hewer wrote: Hi I'm about to start my third, and final, year in computer science at cambridge uni, and i need to come up with an idea for a software project, but i'm really struggling for ideas, and i was wondering whether anyone here had any suggestions. I'd say i'm probably most