Re: piping out binaries properly

2005-10-11 Thread Fredrik Lundh
Andy Leszczynski wrote: > when I run under Unix I got: > > $ python u.py > u.bin > $ od -t x1 u.bin > 000 41 41 0a 41 41 > > and under Windows/Cygwin following: > > $ python u.py > u.bin > $ od -t x1 u.bin > 000 41 41 0d 0a 41 41 > 006 > > The question is how can I pipe out binary cont

Adding a __filename__ predefined attribute to 2.5?

2005-10-11 Thread Rune Strand
Is it an idea to include a new __filename__ predefined attribute to 2.5, so that __file__ contains the entire path to the module, and __filename__ only the name of the module? For instance it's useful to include a not-static reference to the filename in a scripts usage() section and it's cumbersom

Re: bizarro world (was Re: Python Doc Problem Example: sort() (reprise))

2005-10-11 Thread Lasse Vågsæther Karlsen
Bryan wrote: > mr. xah... would you be willing to give a lecture at pycon 2006? i'm > sure you would draw a huge crowd and a lot of people would like to meet > you in person... > > thanks. > I think that would be a highly un-pythonesque crowd. Python isn't much in the sense of limitations, b

Re: piping out binaries properly

2005-10-11 Thread Paul Rubin
Erik Max Francis <[EMAIL PROTECTED]> writes: > > I've written lots of things whose standard out was designed > > specifically to be read by another program, but never as binary data. > > Plenty of applications use that functionality and depend on it. See > cjpeg, djpeg, the pbmplus library, and s

Re: piping out binaries properly

2005-10-11 Thread Mike Meyer
marduk <[EMAIL PROTECTED]> writes: > On Wed, 2005-10-12 at 00:16 -0400, Mike Meyer wrote: > [...] >> It's not normal to write binary content to stdout - you normally write >> it to a file. Open the file with open(name, 'wb') to write binaries. >> > > It is interesting that as a "Unix consultant"

Re: bizarro world (was Re: Python Doc Problem Example: sort() (reprise))

2005-10-11 Thread Bryan
mr. xah... would you be willing to give a lecture at pycon 2006? i'm sure you would draw a huge crowd and a lot of people would like to meet you in person... thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: TurboGears /.-ed, >new == True< or >new == "True"

2005-10-11 Thread Sybren Stuvel
Andy Leszczynski enlightened us with: > should not it be: > > 2 def save(self, pagename, data, submit, new): > 3 hub.begin() > 4 if new == True: > 5 page = Page(pagename=pagename, data=data) > 6 else: > 7 page = Page.byPagename(pagename) > 8 page.data = data > > instead of: > > 4 if new

bizarro world (was Re: Python Doc Problem Example: sort() (reprise))

2005-10-11 Thread Bryan
Xah Lee wrote: > Addendum, 200510 > > Here's further example of Python's extreme low quality of > documentation. In particular, what follows focuses on the bad writing > skill aspect, and comments on some language design and quality issues > of Python. > >>From the Official Python documentation o

Re: piping out binaries properly

2005-10-11 Thread Erik Max Francis
Mike Meyer wrote: > I watched the Unix world grow up, and it ain't normal to me. Since there's no distinction between a file opened in binary mode and in text mode on Unix, there is no difference. > I don't > think I've ever written a program that wrote binary data to standard > out, not in nea

Re: TurboGears /.-ed, >new == True< or >new == "True"

2005-10-11 Thread Fredrik Lundh
Andy Leszczynski wrote: > watch this: > http://www.turbogears.org.nyud.net:8090/docs/wiki20/20MinuteWiki.mov > > or read this: > http://www.turbogears.org.nyud.net:8090/docs/wiki2 0/page4.html > > should not it be: > > 2 def save(self, pagename, data, submit, new): > 3 hub.begin() > 4 if new == Tr

Re: win32com, generating the cache programaticaly?

2005-10-11 Thread Roger Upole
"Andrew Markebo" wrote: > > Hello! > > I am messing around with communicating between LabVIEW and Python, got > it to work by a small 'fix' (grabbing the generated file, and > importing it by hand) > > What I might want to do, is to automatically generate the data done by > executing makepy.py and

Re: piping out binaries properly

2005-10-11 Thread Mike Meyer
Andy Leszczynski writes: > Mike Meyer wrote: >> It's not normal to write binary content to stdout - you normally write > > Well, I grew up in the Unix world and it is normal over there. I watched the Unix world grow up, and it ain't normal to me. I don't think I've ever written a program that wr

Re: piping out binaries properly

2005-10-11 Thread marduk
On Wed, 2005-10-12 at 00:16 -0400, Mike Meyer wrote: [...] > It's not normal to write binary content to stdout - you normally write > it to a file. Open the file with open(name, 'wb') to write binaries. > It is interesting that as a "Unix consultant" you should make that claim. Especially since

Re: Parser suggestion

2005-10-11 Thread [EMAIL PROTECTED]
Take a look at PLY. There is an example lexer in the download for parsing fortran. -- http://mail.python.org/mailman/listinfo/python-list

Re: are there internal functions for these ?

2005-10-11 Thread Grant Edwards
On 2005-10-12, black <[EMAIL PROTECTED]> wrote: > i wrote some functions for copying and moving files caz' i didnt find > concret functions within the doc. but i think these operations are > simple and important so there may be some internal ones i didnt know. http://www.google.com/search?hl=en&q

Re: Can module access global from __main__?

2005-10-11 Thread Neal Norwitz
Steve Holden wrote: > Neal Becker wrote: > > > > Still curious about the answer. If I know that I am imported from __main__, > > then I can do access X as sys.modules[__main__].X. In general, I don't > > know how to determine who is importing me. > > > I don't think you can without huge amounts o

Re: piping out binaries properly

2005-10-11 Thread Andy Leszczynski
Mike Meyer wrote: > It's not normal to write binary content to stdout - you normally write Well, I grew up in the Unix world and it is normal over there. I am still curious which layer adds that 0xd. Is it python, cygwin, windows ... Thx for reply, Andy -- http://mail.python.org/mailman/listin

Re: non descriptive error

2005-10-11 Thread Steven D'Aprano
Timothy Smith wrote: >>> i have NO idea what in there could be making it have such a strange >>> error. it just says "error" when you try run it. there nothing terribly >>> strange being done. > i am still coming across this error it's driving me nuts. usually i can > find what's wrong, but it i

Re: are there internal functions for these ?

2005-10-11 Thread Steven D'Aprano
black wrote: > anyone could figure me out ? No, I suspect people would have to be a trained psychologist to figure you out. *wink* -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: piping out binaries properly

2005-10-11 Thread Mike Meyer
Andy Leszczynski writes: > I have got following program: > > import sys > import binascii > from string import * > sys.stdout.write(binascii.unhexlify("41410A4141")) > > > when I run under Unix I got: > > $ python u.py > u.bin > $ od -t x1 u.bin > 000 41 41 0a 41 41 > > and under Windows/Cygwi

Re: A problem while using urllib

2005-10-11 Thread Johnny Lee
Alex Martelli wrote: > Johnny Lee <[EMAIL PROTECTED]> wrote: >... > >try: > > webPage = urllib2.urlopen(url) > >except urllib2.URLError: >... > >webPage.close() > >return True > > > > > >But every time when I ra

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-11 Thread William Park
Paul Rubin wrote: > Reinhold Birkenfeld <[EMAIL PROTECTED]> writes: > > For a conditional, syntax must be found, and the tradition of Python > > design is not to use punctuation for something that can be solved > > with keywords. > > Yeah, "if C then A else B" is a ancie

Re: Jargons of Info Tech industry

2005-10-11 Thread John Bokma
Paul Rubin wrote: > Roedy Green <[EMAIL PROTECTED]> writes: >> So let's say I decide to send an email to Donald Knuth. > > Good luck. Prof. Knuth stopped reading email years before there was a > big spam problem. Not entirely true: "My secretary prints out all message

Re: where to get modules for python

2005-10-11 Thread gene tani
http://www.python.org/doc/faq/library.html#how-do-i-find-a-module-or-application-to-perform-task-x [EMAIL PROTECTED] wrote: > hi > i am new to python and was wondering where can i find modules for > python? > Something very much like what CPAN has for Perl. > I am searching for SSL/SSH modules for

piping out binaries properly

2005-10-11 Thread Andy Leszczynski
I have got following program: import sys import binascii from string import * sys.stdout.write(binascii.unhexlify("41410A4141")) when I run under Unix I got: $ python u.py > u.bin $ od -t x1 u.bin 000 41 41 0a 41 41 and under Windows/Cygwin following: $ python u.py > u.bin $ od -t x1 u.bi

Re: scipy.plt legend?

2005-10-11 Thread John Hunter
> "gurkesaft" == gurkesaft <[EMAIL PROTECTED]> writes: gurkesaft> Thank you, Robert. I noticed how obsolete it is! gurkesaft> There is no documentation. gurkesaft> Matplotlib freezes my system if I close a plot and make gurkesaft> a new one :(. Bah. Windows :) Have you se

TurboGears /.-ed, >new == True< or >new == "True"

2005-10-11 Thread Andy Leszczynski
watch this: http://www.turbogears.org.nyud.net:8090/docs/wiki20/20MinuteWiki.mov or read this: http://www.turbogears.org.nyud.net:8090/docs/wiki2 0/page4.html should not it be: 2 def save(self, pagename, data, submit, new): 3 hub.begin() 4 if new == True: 5 page = Page(pagename=pagename, dat

Re: [PIL]: Question On Changing Colour

2005-10-11 Thread jepler
If you're always going from grey to tinted, then the easiest way is to treat it as a 'P' image with a special palette. I believe this function will prepare the palette: def make_palette(tr, tg, tb): l = [] for i in range(255): l.extend([tr*i / 255,

Re: are there internal functions for these ?

2005-10-11 Thread Kent Johnson
black wrote: > hi all~ > > i wrote some functions for copying and moving files caz' i didnt find > concret functions within the doc. but i think these operations are > simple and important so there may be some internal ones i didnt know. > anyone could figure me out ? See the os, os.path and shu

Re: HELP: Searching File Manager written in Python

2005-10-11 Thread phil_nospam_schmidt
I don't know about Norton Commander either. But, have you looked at twander? http://www.tundraware.com/Software/twander/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Profiling Python using gprof

2005-10-11 Thread Micah Elliott
On Oct 11, Dave wrote: > I would like to profile a Python program using gprof. I already > rebuilt Python with CC="gcc -pg" ./configure. So, I should be able to > use gprof. How do I do that? Should I first run Python and then gprof? > What are the steps? Note that it is much more common to use Py

Re: Nicer way of strip and replace?

2005-10-11 Thread Kent Johnson
Markus Rosenstihl wrote: > Hi, > I wonder if i can make this nicer: > > euro=euro + float(string.replace(string.strip(rechnung[element][10], > '"'), ',' , '.')) You can use the str methods instead of functions from the string module: euro=euro + float(rechnung[element][10].strip('"').replac

Re: Jargons of Info Tech industry

2005-10-11 Thread Paul Rubin
Roedy Green <[EMAIL PROTECTED]> writes: > So let's say I decide to send an email to Donald Knuth. Good luck. Prof. Knuth stopped reading email years before there was a big spam problem. He uses his own version of hashcash to cut down on unimportant mail: if you want to write to him, you have to

Re: are there internal functions for these ?

2005-10-11 Thread Robert Kern
black wrote: > hi all~ > > i wrote some functions for copying and moving files caz' i didnt find > concret functions within the doc. but i think these operations are > simple and important so there may be some internal ones i didnt know. > anyone could figure me out ? http://docs.python.org/lib/

Re: are there internal functions for these ?

2005-10-11 Thread jepler
there's 'os.rename' for moving (single) files, and several functions in 'shutil' for moving and copying trees of files. Jeff pgpS5MgPvRJQZ.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Profiling Python using gprof

2005-10-11 Thread jepler
It should be the same as for any program $ program-compiled-with-pg $ gprof /path/to/program-compiled-with-pg you'll need to make sure that python is not only *compiled* with -pg but that the *link line* contains -pg as well. That's a common "gotcha" when it comes to profiling. Jeff pgpQy

are there internal functions for these ?

2005-10-11 Thread black
hi all~ i wrote some functions for copying and moving files caz' i didnt find concret functions within the doc. but i think these operations are simple and important so there may be some internal ones i didnt know. anyone could figure me out ? tks~ -- http://mail.python.org/mailman/listinfo/py

Re: Jargons of Info Tech industry

2005-10-11 Thread John Bokma
Roedy Green <[EMAIL PROTECTED]> wrote: > So let's say I decide to send an email to Donald Knuth. :-) -- John Small Perl scripts: http://johnbokma.com/perl/ Perl programmer available: http://castleamber.com/ I ploink g

Re: Jargons of Info Tech industry

2005-10-11 Thread Roedy Green
On Tue, 11 Oct 2005 14:27:30 GMT, [EMAIL PROTECTED] wrote or quoted : >> This would slow them down with requests for permission to send. they >> could send only one per certificate. The cost and hassle of getting >> the certificate could deter tem, and uniquely identify them for >> blocking and

Re: how to execute .exe file ?

2005-10-11 Thread black
tks !!! -- http://mail.python.org/mailman/listinfo/python-list

where to get modules for python

2005-10-11 Thread eight02645999
hi i am new to python and was wondering where can i find modules for python? Something very much like what CPAN has for Perl. I am searching for SSL/SSH modules for use in Python. thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: [PIL]: Question On Changing Colour

2005-10-11 Thread Terry Hancock
On Wednesday 12 October 2005 05:28 pm, Andrea Gavana wrote: > Now my question: is it possible to transform the pixels colours in order to have another basic colour (say blue)? In other words, the predominant colour will become the blue, with other pixels in a brighter or darker blue to give the

Re: pyparallel and MAKE controller board for CRYDOM AC/DC switches

2005-10-11 Thread garyr
Richard Siderits wrote: > Greetings. I am trying to write a small application for controlling CRYDOM > AC and DC switches from the parallel port using pyparallel. The project is > described in the latest issue of MAKE magazine Vol.3 pg 86. All of the > examples are in C, VB, Linux, Unix but not

can we save print msg into a file when script running ?

2005-10-11 Thread black
hi all~ in my .py file there are a few print to trace out some message and i wonder if we can save it into a specified file when that script get running. if so, i may just check that file to c how the script is running. can anyone show me a right direction ? one million tks~ -- http://mail.pyth

Re: Python name lookups / Interning strings

2005-10-11 Thread Terry Hancock
On Tuesday 11 October 2005 05:36 pm, Dave wrote: > What exactly does it mean to "intern" a string? For very simple strings such as "A" and for strings used as identifiers (I think), Python creates a permanent object during byte-code compilation. Thereafter, any time that string value occurs in th

Re: Continuous system simulation in Python

2005-10-11 Thread Nicolas Pernetty
I was implicitly referring to Python/C model for this. I'm aware that Python can be very slow on heavy computations (it's a _documented_ shortcoming), sometimes much slower than Simulink. I believe that no current technology can meet the needs of both rapid prototyping (for projects in their infan

Re: dictionnaries and lookup tables

2005-10-11 Thread m . barenco
Ok, Thanks for your answers, that's pretty unambiguous. M. -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie needs help. Setting PYTHONDOCS to read HTML.

2005-10-11 Thread moondusterone
Yes it did. And it worked! Thank you! moondusterone "Brett Hoerner" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > That's because the Python docs come zipped up within a folder, for > example: > > python_docs.tar.bz2 has a folder inside it called Python-Docs-2.4.2.

Re: Python name lookups / Interning strings

2005-10-11 Thread Martin v. Löwis
Dave wrote: > What exactly does it mean to "intern" a string? "exactly" it means to place lookup the string in the global interning dictionary. If an entry is found, then interning yields the string in the interning dictionary. If the string is not found, it is added to the interning dictionary, a

Re: Looking for info on Python's memory allocation

2005-10-11 Thread Martin v. Löwis
Fredrik Lundh wrote: I = iter(L) I > > > len(I) > > 3 [...] > (it's probably not a good idea to rely on this behaviour...) I believe this has been classified as a bug in Python 2.4, which will be undone in Python 2.5. Regards, Martin -- http://mail.python.org/mailman/listinfo/pyt

Re: non descriptive error

2005-10-11 Thread Timothy Smith
Fredrik Lundh wrote: >Timothy Smith wrote: > > >>i have reproduced the error in this code block >> >>#save values in edit >>self.FinaliseTill.SaveEditControlValue() >>if >>Decimal(self.parent.TillDetails[self.TillSelection.GetStringSelection()]['ChangeTinBalance'])) >>== Decimal('0'): >>#box mus

Re: Nicer way of strip and replace?

2005-10-11 Thread Paul Rubin
Markus Rosenstihl <[EMAIL PROTECTED]> writes: > indeed, it did it correctly by default: > > read_file = csv.reader(open('2005_08_Rechnung_4963184011.dat', 'r'), > delimiter="\t") > for row in read_file: > rechnung.append(row) Oh cool. I think you could even say: rechnung = list(read_fi

Re: Nicer way of strip and replace?

2005-10-11 Thread Markus Rosenstihl
On 2005-10-11 23:45:46 +0200, Paul Rubin said: > Markus Rosenstihl <[EMAIL PROTECTED]> writes: >> This looks ugly (I htink) and I wonder if there is a nicer way to >> strip commata and change the comma to a dot already when reading in. >> Or should i do it with a shell

Re: Python Doc Problem Example: sort() (reprise)

2005-10-11 Thread Xah Lee
Addendum, 200510 Here's further example of Python's extreme low quality of documentation. In particular, what follows focuses on the bad writing skill aspect, and comments on some language design and quality issues of Python. >From the Official Python documentation of the sort() method, at: http:

Re: dictionnaries and lookup tables

2005-10-11 Thread Steven D'Aprano
On Tue, 11 Oct 2005 11:50:24 -0700, m.barenco wrote: > Just to build up on that, when I run: > > #start of listing > import random > > A={1:None,2:None,"hello":None,(1,2,3):None} > > def dictcomp(n): > for i in range(n): > B=A.copy() > C=A.copy() >

Re: Newbie needs help. Setting PYTHONDOCS to read HTML.

2005-10-11 Thread Brett Hoerner
That's because the Python docs come zipped up within a folder, for example: python_docs.tar.bz2 has a folder inside it called Python-Docs-2.4.2. You need to have C:\Python24\Python-Docs-2.4.2\ as the value if thats where that folder is, or wherever you unzipped it. I, personally, just took all t

RE: Looking for info on Python's memory allocation

2005-10-11 Thread Delaney, Timothy (Tim)
Fredrik Lundh wrote: > Alex Martelli wrote: > >> (there is no common Python type on which you can both call >> len(...) AND the .next() method, for example -- a combination >> which really makes no sense). > L = [1, 2, 3] len(L) > 3 I = iter(L) I > > > (it's probably not a g

Re: Python name lookups / Interning strings

2005-10-11 Thread Dave
--- [EMAIL PROTECTED] wrote: > lookdict_string is used for most lookups of the form > obj.attr > because they are never found to have non-string keys > entered or searched. > > Furthermore, most of these string keys are > "interned", > which I believe makes the check > if (ep->me_ke

[PIL]: Question On Changing Colour

2005-10-11 Thread Andrea Gavana
Hello NG,   First of all, sorry if this is not the right newsgroup.   I have a small image that looks like a GUI button (with 3D effects given by different pixels colours). The current image has as "basic" colour the grey. For "basic", I mean that the predominant colour in the image is grey

Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-10-11 Thread Terry Hancock
On Tuesday 11 October 2005 09:37 am, Grant Edwards wrote: > On 2005-10-10, Terry Hancock <[EMAIL PROTECTED]> wrote: > >> Likewise, "dude" is often used when addressing a female but > >> almost never when speaking about one in the third person. > > > > This I have never witnessed. That's bizarre. >

Profiling Python using gprof

2005-10-11 Thread Dave
Hello, I would like to profile a Python program using gprof. I already rebuilt Python with CC="gcc -pg" ./configure. So, I should be able to use gprof. How do I do that? Should I first run Python and then gprof? What are the steps? Thanks a lot! _

Re: Nicer way of strip and replace?

2005-10-11 Thread Diez B. Roggisch
> I replace commata with dots, then delete leading/trailing "s then add to > a sum after converting it to a float. > This looks ugly (I htink) and I wonder if there is a nicer way to strip > commata and change the comma to a dot already when reading in. It's not ugly - it's necessary. > Or sho

Re: Jargons of Info Tech industry

2005-10-11 Thread Steven D'Aprano
On Tue, 11 Oct 2005 14:27:30 +, axel wrote: > I don't know how much spam other people receive but on one account I > hardly receive any as I reserve it for friends and business. On another > I had about 40 spam messages which took all of ten seconds to delete. > Hardly a serious matter. Can I

Re: HELP: Searching File Manager written in Python

2005-10-11 Thread Chris F.A. Johnson
On 2005-10-11, anton wrote: > > I am googeling some hours now ... still without result. > > So I have a question: > > Does somebody know a filemanager: > > - which looks like Norton Commander/7-Zip Filemanager What does Norton Commander/7-Zip look like? > - where I can add python scripts wh

Re: Nicer way of strip and replace?

2005-10-11 Thread Paul Rubin
Markus Rosenstihl <[EMAIL PROTECTED]> writes: > This looks ugly (I htink) and I wonder if there is a nicer way to > strip commata and change the comma to a dot already when reading in. > Or should i do it with a shell script before processing in python? First of all you should just set your local

Re: Python's garbage collection was Re: Python reliability

2005-10-11 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: > > Has anyone looked into using a real GC for python? ... > > lot more complexity in the interpreter itself, but it would be faster, > > more reliable, and would reduce the complexity of extensions. > > ??? It adds no complexity (it's already there), it'

Re: python interpreter

2005-10-11 Thread Paul Rubin
"g.franzkowiak" <[EMAIL PROTECTED]> writes: > Where can I find informations like this for Python ? "Use the force, read the source". Python's interpreter is more like a big switch statement on bytecodes, though. -- http://mail.python.org/mailman/listinfo/python-list

Nicer way of strip and replace?

2005-10-11 Thread Markus Rosenstihl
Hi, I wonder if i can make this nicer: In my case a list is created from a bill which is a tab seperated file and each line looks like this: "Verbindungen Deutsche Telekom vom 03.08.2005 bis 10.08.2005" "ISDN" "Deutsche Telekom AG" "Rufnummer" "123456789" "3" "Verbindunge

Re: Let My Terminal Go

2005-10-11 Thread Dan Stromberg
On Tue, 11 Oct 2005 03:30:23 -0700, Mystilleef wrote: > Hello, > > Thank you. That's all I needed. For some reason, I had always assumed > forking was an expensive process. I guess I was ill-informed. In a loop, yes, it's expensive. Done once, it's usually not unacceptable. -- http://mail.pyt

Re: scipy.plt legend?

2005-10-11 Thread gurkesaft
Thank you, Robert. I noticed how obsolete it is! There is no documentation. Matplotlib freezes my system if I close a plot and make a new one :(. Bah. Windows :) Anyway, I figured out how to make gnuplot.py do my bidding. -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: datetime and daylight savings problem

2005-10-11 Thread [EMAIL PROTECTED]
When working with timezones datetime objects are represented in the tzinfo object you supply, eg. when you define these classes (and run them on a system set to Paris time): from datetime import tzinfo, timedelta, datetime import time class UTC(tzinfo): """UTC timezone""" def utcoffset(s

Re: Class property

2005-10-11 Thread Steven Bethard
Laszlo Zsolt Nagy wrote: > class A(object): >cnt = 0 >a_cnt = 0 >def __init__(self): >A.cnt += 1 >if self.__class__ is A: >A.a_cnt += 1 > class B(A): >pass > print A.cnt,A.a_cnt # 0,0 > b = B() > print A.cnt,A.a_cnt # 1,0 > a = A() > print A.c

Re: dictionnaries and lookup tables

2005-10-11 Thread Steve Holden
[EMAIL PROTECTED] wrote: >>Sure they're implemented. > > > Oops, my apologies. > > Just to build up on that, when I run: > > #start of listing > import random > > A={1:None,2:None,"hello":None,(1,2,3):None} > > def dictcomp(n): > for i in range(n): > B=A.copy() >

Re: Wanted: Python module allowing direct access to raw sectors ofharddrives (MFT, boot sector, etc.) in MS Windows

2005-10-11 Thread sam
The main use of my SCSI routines,is that by using the SCSIPASSTHROUGH layer under Windows gives the user absolute control of the storage device. For example copying data from and IDE drive to a SCSI drive becomes transparent using SCSI commands. I.e Logical block 0 remains consistant. I had an PHD

disable Pmw.Counter?

2005-10-11 Thread Benjamin Rutt
Does anyone know how to disable a Pmw.Counter? (make it so it cannot be changed, but you can still call the get() function to see its current value?) Thanks, -- Benjamin Rutt -- http://mail.python.org/mailman/listinfo/python-list

Re: What's the best SNMP interface?

2005-10-11 Thread Grig Gheorghiu
I used pySNMP successfully. I think it's the most active SNMP-related Python project too. Grig -- http://mail.python.org/mailman/listinfo/python-list

Re: unable to import os

2005-10-11 Thread jepler
Concatenating filenames with "+" is seldom what you want. Instead, you should use os.path.join (or, to decrease portability, nt.path.join). Jeff pgpUKTuVnB2qh.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Help creating extension for C function

2005-10-11 Thread Java and Swing
quick question...how about returning an array of longs? ..or in my case I have a pointer to an array of longs. Thanks Carsten Haese wrote: > On Tue, 2005-10-11 at 15:14, Java and Swing wrote: > > Anyhow, I need PyBuildValue to work. > > Try Py_BuildValue. > > HTH, > > Carsten Haese. -- htt

Re: Help creating extension for C function

2005-10-11 Thread Java and Swing
Carsten..thanks so much...that was it! DUH! Carsten Haese wrote: > On Tue, 2005-10-11 at 15:14, Java and Swing wrote: > > Anyhow, I need PyBuildValue to work. > > Try Py_BuildValue. > > HTH, > > Carsten Haese. -- http://mail.python.org/mailman/listinfo/python-list

Re: unable to import os

2005-10-11 Thread ktxn1020
I had the following code run with Python for Delphi. It works. while IsCDriveNotEnoughSpace(): dirlist = nt.listdir(CPath) listsize = len(dirlist) if listsize > 2: file = dirlist[0] nt.remove(CPath + dirlist[0]) PyLog(file + " in C:\logs has been delete

Re: Help creating extension for C function

2005-10-11 Thread Carsten Haese
On Tue, 2005-10-11 at 15:14, Java and Swing wrote: > Anyhow, I need PyBuildValue to work. Try Py_BuildValue. HTH, Carsten Haese. -- http://mail.python.org/mailman/listinfo/python-list

Re: Help creating extension for C function

2005-10-11 Thread Java and Swing
..ok I modified wrap_doStuff, so it just returns 0 instead of return PyBuildValuethis fixed the problems I had with compiling. however, when I try using it in Python..I get a SystemError: error return without exception set. Anyhow, I need PyBuildValue to work. One other note, the VC++ 6 comp

Re: Learning Python

2005-10-11 Thread Markus Rosenstihl
On 2005-10-10 18:50:18 +0200, Paul DiRezze <[EMAIL PROTECTED]> said: > I'm spending the next two weeks off and I'm looking to take a crack at > learning how to program in Python. Here's a list of the places I've > bookmarked: > > http://www.python.org/doc/ and more specifically > http://wiki.p

Re: dictionnaries and lookup tables

2005-10-11 Thread m . barenco
>Sure they're implemented. Oops, my apologies. Just to build up on that, when I run: #start of listing import random A={1:None,2:None,"hello":None,(1,2,3):None} def dictcomp(n): for i in range(n): B=A.copy() C=A.copy() b=random.uniform(0,

Reminder: PyCon proposal deadline is Oct. 31st

2005-10-11 Thread A.M. Kuchling
The deadline for PyCon proposals is now three weeks away; proposals must be received by Oct. 31st. Read the call for proposals for what we're looking for and how to submit: The proposal submission site is . A.M. Kuchling Chair, PyC

Re: dictionnaries and lookup tables

2005-10-11 Thread gry
[EMAIL PROTECTED] wrote: > Hello, > > I am considering using dictionnaries as lookup tables e.g. > > >>>D={0.5:3.9,1.5:4.2,6.5:3} > > and I would like to have a dictionnary method returning the key and > item of the dictionnary whose key is smaller than the input of the > method (or <=,>,>=) but m

Re: Help creating extension for C function

2005-10-11 Thread Java and Swing
Fredrik, I now have this. myapp.c #include #include #include "Python.h" int doStuff(const char *input, const char *d) { ... } static PyObject *wrap_doStuff(PyObject *self, PyObject *args) { // get the arguments from Python int result; char *input = 0;

Re: Looking for info on Python's memory allocation

2005-10-11 Thread Fredrik Lundh
Alex Martelli wrote: > (there is no common Python type on which you can both call > len(...) AND the .next() method, for example -- a combination > which really makes no sense). >>> L = [1, 2, 3] >>> len(L) 3 >>> I = iter(L) >>> I >>> len(I) 3 >>> I.next() 1 >>> len(I) 2 >>> I.next() 2 >>> len(I

Re: Wrapper function

2005-10-11 Thread Java and Swing
So, I write the C code...as shown previously. Then, I do something like... c:\> python >> from distutils.core import setup, Extension >> >>setup( >>name="DLLTester", >>ext_modules = [Extension("DLLTester", ["test.c"])] >>) c:\> python setup.py build_ext -i ..is that it? If so, then

Re: Help creating extension for C function

2005-10-11 Thread Fredrik Lundh
Java and Swing wrote: > So is "module.c" a new C file or do I add it to my existing, myapp.c? it's a complete module. if you want it to do something other than printing the arguments, replace the "do stuff" section with your own code. if you want to call it something else, rename it. if you wa

Re: unable to import os

2005-10-11 Thread ktxn1020
It works fine independently, but still not work when run with Python for Delphi. -- http://mail.python.org/mailman/listinfo/python-list

Re: dictionnaries and lookup tables

2005-10-11 Thread jepler
On Tue, Oct 11, 2005 at 11:06:32AM -0700, [EMAIL PROTECTED] wrote: > Note that when I type: > >>>dir(D) [...] > the functions __ge__, __gt__, __lt__, __le__ seem to be non-implemented > but there is some __doc__ in them. Is there the intention to do > something similar as is described above or are

Re: Wrapper function

2005-10-11 Thread Robert Kern
Java and Swing wrote: > When I compile, I get two warnings..which are ok. Then when I build my > DLL I get.. > > Linking... >Creating library Release/MyDLL.lib and object Release/MyDLL.exp > test.obj : error LNK2001: unresolved external symbol _PyBuildValue > Release/MyDLL.dll : fatal error

dictionnaries and lookup tables

2005-10-11 Thread m . barenco
Hello, I am considering using dictionnaries as lookup tables e.g. >>>D={0.5:3.9,1.5:4.2,6.5:3} and I would like to have a dictionnary method returning the key and item of the dictionnary whose key is smaller than the input of the method (or <=,>,>=) but maximal (resp. maximal,minimal,minimal) eg

Re: Wrapper function

2005-10-11 Thread Java and Swing
Diez, yes you were right! But I have other problems now. I now have... #include #include #include "Python.h" int doStuff(const char *input, const char *d) {...} static PyObject *wrap_doStuff(PyObject *self, PyObject *args) { int result; char *input = 0; char *d = 0;

Re: Wrapper function

2005-10-11 Thread Robert Kern
Java and Swing wrote: > I am having trouble with a wrapper function... > > My C code looks like > --- > #include > #include > #include "Python.h" > > int doStuff(const char *input, const char *d) {...} > > PyObject *wrap_doStuff(PyObject *, PyObject *args) { PyObject *wrap

Re: Wrapper function

2005-10-11 Thread Diez B. Roggisch
> PyObject *wrap_doStuff(PyObject *, PyObject *args) { ^ I guess you need a parameter name here Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Learning Python

2005-10-11 Thread Daniel Schüle
Paul DiRezze wrote: > I'm spending the next two weeks off and I'm looking to take a crack at > learning how to program in Python. Here's a list of the places I've > bookmarked: > > http://www.python.org/doc/ and more specifically > http://wiki.python.org/moin/ > http://wiki.python.org/moin/Begi

Wrapper function

2005-10-11 Thread Java and Swing
I am having trouble with a wrapper function... My C code looks like --- #include #include #include "Python.h" int doStuff(const char *input, const char *d) {...} PyObject *wrap_doStuff(PyObject *, PyObject *args) { int result; char *input = 0; char *

Re: Best way to share a python list of objects

2005-10-11 Thread Tim Arnold
"Magnus Lycka" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > kyle.tk wrote: >> So I have a central list of python objects that I want to be able to >> share between different process that are possibly on different >> computers on the network. Some of the processes will add objects

  1   2   3   >