Re: Bidirectional Networking

2008-12-11 Thread Tobias Andersson
Emanuele D'Arrigo skrev: [...] What if the server wanted to notify the client of something of interest, i.e. new data that the client should take into consideration and potentially process? If the protocol is relatively simple perhaps you can implement something similar to IMAP's "IDLE":

Re: Py_GetPath() C API in python 3

2008-12-11 Thread stalex
On 12月11日, 下午5時53分, stalex wrote: > Hi all, > > I want to build a new, requires total control, python interpreter. So > I implement my own version of Py_GetPath(), Py_GetPrefix(), > Py_GetExecPrefix() and Py_GetProgramFullPath(). When compiling, I > always get error messages, for each API function

Re: How do I manually uninstall setuptools (installed by egg)?

2008-12-11 Thread excord80
On Dec 10, 7:45 am, "Diez B. Roggisch" wrote: > excor...@gmail.com wrote: > > > As an aside, I'm a bit struck by how long the setuptools/easy_install > > manuals are, and a bit dismayed at the lack of an easy_install > > uninstall command. Thinking of trying life for a while without > > setuptools

Re: how to convert '\xf0' to 0xf0 ?

2008-12-11 Thread Steve Holden
Looks like you need the struct module. That can convert binary fields of various lengths into the appropriate Python types, and vice versa. >>> import struct >>> struct.unpack("L", '\xf0\xf0\xff\xfe') (4278186224L,) >>> struct.unpack("l", '\xf0\xf0\xff\xfe') (-16781072,) >>> regards Steve cheng

Re: how to convert '\xf0' to 0xf0 ?

2008-12-11 Thread Stephen Thorne
On 2008-12-11, chengang.beij...@gmail.com wrote: > Hi, > > ord('\xf0') works and it only works for char. Do you know any way to > convet > '\xf0\xf0' and '\xf0\xf0\xff\xfe' to integer? Perhaps you want the 'struct' module. >>> struct.unpack('!hi', '\xf0\xf0\xf0\xf0\xff\xfe') (-3856, -252641282)

concept of creating structures in python

2008-12-11 Thread navneet khanna
Hello Everybody I want to create a structure within a structure i.e. nested structures in python. I tried with everything but its not working. my code is like this: class L(Structure): def __init__(self,Name='ND',Addr=0,ds_obj = D()): self.Name = Name self.Addr = Addr

Apache Tapestry Creator to Speak on Clojure, Tapestry 5

2008-12-11 Thread Shaguf
Apache Tapestry Creator to Speak on Clojure, Tapestry 5 Bangalore, December 10, 2008: If you are a Java developer building web- based applications and tired of the countless frameworks that promise you a slick UI fast but fail to live up to their promise, then switch to Apache Tapestry to get more

Re: how to convert '\xf0' to 0xf0 ?

2008-12-11 Thread Benjamin Kaplan
On Fri, Dec 12, 2008 at 12:28 AM, wrote: > Hi, > > ord('\xf0') works and it only works for char. Do you know any way to > convet > '\xf0\xf0' and '\xf0\xf0\xff\xfe' to integer? > Is that supposed to be a single integer or 4 integers? Either way, you'd use a for loop to iterate over each characte

Re: how to convert '\xf0' to 0xf0 ?

2008-12-11 Thread chengang . beijing
Hi, ord('\xf0') works and it only works for char. Do you know any way to convet '\xf0\xf0' and '\xf0\xf0\xff\xfe' to integer? Br, Chen Gang On Dec 12, 12:40 pm, Steve Holden wrote: > chengang.beij...@gmail.com wrote: > > '\xf0' is the value read from a binary file, I need to change this > > ki

Re: how to convert ‘\xf0' to 0xf0 ?

2008-12-11 Thread peterca...@gmail.com
On Dec 12, 4:48 am, chengang.beij...@gmail.com wrote: > int('\xf0',16) doesn't work, any way to do that? hex(ord('\xf0')) HTH, Pete -- http://mail.python.org/mailman/listinfo/python-list

Re: how to convert '\xf0' to 0xf0 ?

2008-12-11 Thread Steve Holden
chengang.beij...@gmail.com wrote: > '\xf0' is the value read from a binary file, I need to change this > kinds strings to int for further processing... > if it is in C, then '\xf0' is an integer and it can be handled > directly, but in python, it is a string. > > and both int('10',16) and int('0x1

Re: how to convert ‘\xf0' to 0xf0 ?

2008-12-11 Thread chengang . beijing
'\xf0' is the value read from a binary file, I need to change this kinds strings to int for further processing... if it is in C, then '\xf0' is an integer and it can be handled directly, but in python, it is a string. and both int('10',16) and int('0x10',16) returns 16. Br, Chen Gang On Dec 12,

Re: pydb 1.24

2008-12-11 Thread R. Bernstein
J Kenneth King writes: > > I watched the demo video, look forward to working with it. Any links to > that emacs front-end being used in the video? > > Cheers and thanks! In short, the emacs code is bundled in with the tar and should be installed when you run "make install" However if you inst

Re: how to convert ‘\xf0' to 0xf0 ?

2008-12-11 Thread Tommy Nordgren
On Dec 12, 2008, at 4:48 AM, chengang.beij...@gmail.com wrote: int('\xf0',16) doesn't work, any way to do that? -- http://mail.python.org/mailman/listinfo/python-list Should be int('10',16) or int('0x10',16) -- "Home is not where you

how to convert ‘\xf0' to 0xf0 ?

2008-12-11 Thread chengang . beijing
int('\xf0',16) doesn't work, any way to do that? -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie question: if var1 == var2:

2008-12-11 Thread John Machin
On Dec 12, 1:11 pm, MRAB wrote: > John Machin wrote: > > On Dec 12, 11:39 am, MRAB wrote: > >> Jason Scheirer wrote: > >>> On Dec 11, 3:49 pm, John Machin wrote: > On Dec 12, 10:31 am, "Rhodri James" > wrote: > > On Thu, 11 Dec 2008 19:49:23 -, Steve Holden   > > wrote: >

Re: Rename of .mdb file -- lock

2008-12-11 Thread Steve Holden
noydb wrote: > On Dec 11, 9:38 pm, "gudonghua+pyt...@gmail.com" > wrote: [...] > > Thanks! That was simple enough. > > And... > ##os.rename(new91mdb, (os.path.join(output_dir, uChoice))) > os.rename(new91mdb, (os.path.join(output_dir, "C:\TEMP\test1.mdb"))) > > ... of those two lines, the top

Disputing Cookie.py's definition of valid characters

2008-12-11 Thread Joshua Kugler
Some investigation today revealed that Cookie.py thinks these are valid characters for names and values of cookies: _LegalCharsPatt = r"[\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=]" The rest, presumably being encoded via %NN. I notice that (), {}, and others made the list, but not []. Is the

Re: Rename of .mdb file -- lock

2008-12-11 Thread noydb
On Dec 11, 9:38 pm, "gudonghua+pyt...@gmail.com" wrote: > On Dec 12, 10:15 am, noydb wrote: > > > > > All, > > > I have the code below, which unzips a zipfile containing only one > > file.  Once it is unzipped, I want to rename the file based on a user > > provided name.  But I get this (WindowsE

Re: Rename of .mdb file -- lock

2008-12-11 Thread gudonghua+pyt...@gmail.com
On Dec 12, 10:15 am, noydb wrote: > All, > > I have the code below, which unzips a zipfile containing only one > file.  Once it is unzipped, I want to rename the file based on a user > provided name.  But I get this (WindowsError: [Error 32] The process > cannot access the file because it is being

Rename of .mdb file -- lock

2008-12-11 Thread noydb
All, I have the code below, which unzips a zipfile containing only one file. Once it is unzipped, I want to rename the file based on a user provided name. But I get this (WindowsError: [Error 32] The process cannot access the file because it is being used by another process) error, which does no

Re: newbie question: if var1 == var2:

2008-12-11 Thread MRAB
John Machin wrote: On Dec 12, 11:39 am, MRAB wrote: Jason Scheirer wrote: On Dec 11, 3:49 pm, John Machin wrote: On Dec 12, 10:31 am, "Rhodri James" wrote: On Thu, 11 Dec 2008 19:49:23 -, Steve Holden wrote: Kirk Strauser wrote: At 2008-11-29T04:02:11Z, Mel writes: You could try

Re: Bidirectional Networking

2008-12-11 Thread James Mills
Have a look at circuits. http://trac.softcircuit.com.au/circuits/ It's a general purpose event-driven framework with a focus on Component architectures and has a good set of Networking Components, specifically: circuits.lib.sockets * TCPServer * TCPClient * UDPServer * UDPClient (alias of UDP

Re: newbie question: if var1 == var2:

2008-12-11 Thread John Machin
On Dec 12, 11:39 am, MRAB wrote: > Jason Scheirer wrote: > > On Dec 11, 3:49 pm, John Machin wrote: > >> On Dec 12, 10:31 am, "Rhodri James" > >> wrote: > > >>> On Thu, 11 Dec 2008 19:49:23 -, Steve Holden   > >>> wrote: > Kirk Strauser wrote: > > At 2008-11-29T04:02:11Z, Mel writ

Re: newbie question: if var1 == var2:

2008-12-11 Thread Rhodri James
On Thu, 11 Dec 2008 23:49:10 -, John Machin wrote: On Dec 12, 10:31 am, "Rhodri James" wrote: On Thu, 11 Dec 2008 19:49:23 -, Steve Holden   wrote: > ... and it's so hard to write >      item = item[:-1] Tsk.  That would be "chop".  "chomp" would be      if item[-1] == '\n':    

Re: Converting c header file to a python file

2008-12-11 Thread Gabriel Genellina
En Thu, 11 Dec 2008 10:28:21 -0200, tarun escribió: I am looking for a tool/utility by which can convert c header file to a python file. A typical header file that I want convert looks like: Locate h2py.py somewhere in your Python distribution. From the comments: # Read #define's and trans

Moving to subprocess from os.popen--pipe closes prematurely

2008-12-11 Thread Kevin Walzer
Hello, I'm trying to move from os.popen to using subprocess, and I'm having trouble with the pipe suddenly closing. My old code looked something like this: #build and format a list of all packages def getAllPackages(self): self.masterlist=[] for self.catname in self.ca

PyQt: Pulling Abstract Item Data from Mime Data using Drag and Drop.

2008-12-11 Thread Mudcat
I'm trying to drag/drop info from a TreeWidget into a TextBox. I have been able to modify the TextEdit box to override the dragEnterEvent like this: class TextEdit(QtGui.QTextEdit): def __init__(self, title, parent): QtGui.QTextEdit.__init__(self, title, parent) self.setA

problem adding custom module in cgi script

2008-12-11 Thread bobicanprogram
Problem: Apache server serving an HTML file to a Firefox Browser containing a form and a CGI python CGI script. HTML works fine, meat of the CGI script works fine except that when a home grown and ordinarily functional module that is to be imported is added, the interpreter cannot find it. Runnin

Re: Find Files in a Folder Between 2 Dates

2008-12-11 Thread Gregory Plantaine
On Dec 11, 11:02 am, Gregory Plantaine wrote: > On Dec 5, 3:14 pm, John Machin wrote: > > > > > > > On Dec 6, 9:41 am, GregoryPlantaine wrote: > > > > That worked perfectly! > > > > Thanks Tim! > > > > Since we can print the files, does that mean the list of files is in a > > > tuple, or somethin

Re: newbie question: if var1 == var2:

2008-12-11 Thread MRAB
Jason Scheirer wrote: On Dec 11, 3:49 pm, John Machin wrote: On Dec 12, 10:31 am, "Rhodri James" wrote: On Thu, 11 Dec 2008 19:49:23 -, Steve Holden wrote: Kirk Strauser wrote: At 2008-11-29T04:02:11Z, Mel writes: You could try for item in fname: item = item.strip() This is o

Bidirectional Networking

2008-12-11 Thread Emanuele D'Arrigo
Hi everybody! A networking question! I've been looking at and tinkering a little with the various networking modules in python. The examples are pretty clear and a module such as the SimpleXMLRPCServer is actually simple! All the examples though are based on a client interrogating a server, with

Re: Dictionary as Keyword Arguments

2008-12-11 Thread Chris Rebert
On Thu, Dec 11, 2008 at 4:02 PM, bfrederi wrote: > I was wondering if I had a dictionary of keywords and values like so: > > keyword_arg_dict = { >'attribute': 'stone', >'contents': 'cave people', >'path': '/path/to/cave', >'name': 'Ogg's Cave', >} > > And I had a function that

Dictionary as Keyword Arguments

2008-12-11 Thread bfrederi
I was wondering if I had a dictionary of keywords and values like so: keyword_arg_dict = { 'attribute': 'stone', 'contents': 'cave people', 'path': '/path/to/cave', 'name': 'Ogg's Cave', } And I had a function that accepted keyword arguments like so: make_dwelling( attrib

Re: Preventing execution of a method

2008-12-11 Thread Emanuele D'Arrigo
On Dec 11, 11:46 pm, greg wrote: > Emanuele D'Arrigo wrote: > > -IF- the application was single-user yes, it wouldn't be a big deal. > > But as it is potentially multi-user, I don't want one party to corrupt > > the application for everybody else. > > In that case you definitely want a client-serv

any Python developers available in the Denver area?

2008-12-11 Thread Joe Strout
My company is considering a contract job that would require some development staff on the client site in Denver. We'd like to subcontract some of that work. If you're a good Python coder in the Denver area, and would be available at least three days a week starting in January, please send

Re: var or inout parm?

2008-12-11 Thread mh
J. Clifford Dyer wrote: > Just google for call-by-object, and ignore the hell out of that thread. Now I've got to go read it! ;-) -- Mark Harrison Pixar Animation Studios -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie question: if var1 == var2:

2008-12-11 Thread Jason Scheirer
On Dec 11, 3:49 pm, John Machin wrote: > On Dec 12, 10:31 am, "Rhodri James" > wrote: > > > > > On Thu, 11 Dec 2008 19:49:23 -, Steve Holden   > > wrote: > > > > Kirk Strauser wrote: > > >> At 2008-11-29T04:02:11Z, Mel writes: > > > >>> You could try > > > >>> for item in fname: > > >>>    

Re: Best way of debigging a C extension

2008-12-11 Thread Diez B. Roggisch
Christian Heimes schrieb: Diez B. Roggisch schrieb: I never tried this on windows - but what happens if you start python inside GDB, and then set breakpoints inside your extension? This works flawlessly for me under *nix. The debug-build of python isn't needed for this - and I doubt a bit that

Re: Best way of debigging a C extension

2008-12-11 Thread Christian Heimes
Paul Moore schrieb: > The trouble is, I only have mingw to build extensions, not MSVC7.1 - > so I can't build Python (and I don't know if I still have the toolkit > compiler to build with that - I certainly don't have all the pieces > installed). With Python 2.6, I guess things will be better as I

Re: newbie question: if var1 == var2:

2008-12-11 Thread John Machin
On Dec 12, 10:31 am, "Rhodri James" wrote: > On Thu, 11 Dec 2008 19:49:23 -, Steve Holden   > wrote: > > > > > Kirk Strauser wrote: > >> At 2008-11-29T04:02:11Z, Mel writes: > > >>> You could try > > >>> for item in fname: > >>>     item = item.strip() > > >> This is one case where I really

Re: newbie question: if var1 == var2:

2008-12-11 Thread greg
Kirk Strauser wrote: At 2008-12-11T19:49:23Z, Steve Holden writes: item = item[:-1] It's easy - and broken. Bad things happen if you're using something other than '\n' for EOL. Or if the last line of your file doesn't end with a newline. -- Greg -- http://mail.python.org/mailman/lis

Re: Best way of debigging a C extension

2008-12-11 Thread Christian Heimes
Diez B. Roggisch schrieb: > I never tried this on windows - but what happens if you start python > inside GDB, and then set breakpoints inside your extension? > > This works flawlessly for me under *nix. > > The debug-build of python isn't needed for this - and I doubt a bit that > it helps you m

Re: Preventing execution of a method

2008-12-11 Thread greg
Emanuele D'Arrigo wrote: -IF- the application was single-user yes, it wouldn't be a big deal. But as it is potentially multi-user, I don't want one party to corrupt the application for everybody else. In that case you definitely want a client-server architecture, with the server managing all t

Re: list organization question

2008-12-11 Thread John Machin
On Dec 12, 10:17 am, Robocop wrote: > I'm currently trying something along the lines of a sort.compare, but > as i'm never sure how many mini-lists i'll end up with, i'm not sure > how exactly to begin.  Maybe something like a C vector, i.e. a list of > pointers to other lists?  Or more specifical

Re: list organization question

2008-12-11 Thread Robocop
On Dec 11, 3:31 pm, Arnaud Delobelle wrote: > Robocop writes: > > I have a list of objects, each object having two relevant attributes: > > date and id.  I'd like not only organize by id, but also by date. > > I.e. i would like to parse my list into smaller lists such that each > > new mini-list

Re: list organization question

2008-12-11 Thread Arnaud Delobelle
Robocop writes: > I have a list of objects, each object having two relevant attributes: > date and id. I'd like not only organize by id, but also by date. > I.e. i would like to parse my list into smaller lists such that each > new mini-list has a unique date, but consists of only objects with a

Re: newbie question: if var1 == var2:

2008-12-11 Thread Rhodri James
On Thu, 11 Dec 2008 19:49:23 -, Steve Holden wrote: Kirk Strauser wrote: At 2008-11-29T04:02:11Z, Mel writes: You could try for item in fname: item = item.strip() This is one case where I really miss Perl's "chomp" function. It removes a trailing newline and nothing else, so

Re: list organization question

2008-12-11 Thread MRAB
Robocop wrote: I have a list of objects, each object having two relevant attributes: date and id. I'd like not only organize by id, but also by date. I.e. i would like to parse my list into smaller lists such that each new mini-list has a unique date, but consists of only objects with a specific

Re: Python is slow

2008-12-11 Thread Giampaolo Rodola'
On 11 Dic, 13:06, Luis M. González wrote: > On Dec 10, 3:42 pm, cm_gui wrote: > > > > > > >http://blog.kowalczyk.info/blog/2008/07/05/why-google-should-sponsor-... > > > I fully agree with Krzysztof Kowalczyk . > > Can't they build a faster VM for Python since they love the language > > so much?

Re: list organization question

2008-12-11 Thread Joe Strout
On Dec 11, 2008, at 4:12 PM, Robocop wrote: I have a list of objects, each object having two relevant attributes: date and id. I'd like not only organize by id, but also by date. I.e. i would like to parse my list into smaller lists such that each new mini-list has a unique date, but consists o

Re: list organization question

2008-12-11 Thread Robocop
I'm currently trying something along the lines of a sort.compare, but as i'm never sure how many mini-lists i'll end up with, i'm not sure how exactly to begin. Maybe something like a C vector, i.e. a list of pointers to other lists? Or more specifically, compare dates in my list, push that into

list organization question

2008-12-11 Thread Robocop
I have a list of objects, each object having two relevant attributes: date and id. I'd like not only organize by id, but also by date. I.e. i would like to parse my list into smaller lists such that each new mini-list has a unique date, but consists of only objects with a specific id. Are there a

Re: HGE and Python (again)

2008-12-11 Thread Diez B. Roggisch
Cro schrieb: Good day. I've been trying to port HGE (http://hge.relishgames.com) to Python for more than 4 months now... HGE is a hardware accelerated 2D game engine. It comes with the source and examples. In the folder "include", you can find "hge.h", the file that i am talking about in all the

Re: Best way of debigging a C extension

2008-12-11 Thread Diez B. Roggisch
Grant Edwards schrieb: On 2008-12-11, Diez B. Roggisch wrote: I never tried this on windows - but what happens if you start python inside GDB, and then set breakpoints inside your extension? This works flawlessly for me under *nix. The debug-build of python isn't needed for this - and I doub

Re: Best way of debigging a C extension

2008-12-11 Thread Grant Edwards
On 2008-12-11, Diez B. Roggisch wrote: > I never tried this on windows - but what happens if you start > python inside GDB, and then set breakpoints inside your > extension? > > This works flawlessly for me under *nix. > > The debug-build of python isn't needed for this - and I doubt > a bit that

Re: Mathematica 7 compares to other languages

2008-12-11 Thread Jon Harrop
Xah Lee wrote: > On Dec 10, 2:47 pm, John W Kennedy wrote: >> Xah Lee wrote: >> > In lisp, python, perl, etc, you'll have 10 or so lines. In C or Java, >> > you'll have 50 or hundreds lines. >> >> C: >> >> #include >> #include >> >> void normal(int dim, float* x, float* a) { >> float sum = 0.0f;

Re: Best way of debigging a C extension

2008-12-11 Thread Diez B. Roggisch
Paul Moore schrieb: I'm writing a C extension. My environment is Python 2.5, with the mingw compiler, on Windows XP. At the moment I'm debugging by scattering printf() statements around, but it's not always easy. Is there a better way of debugging - particularly for diagnosing crashes? I have gd

Re: Python 2.5.2 error on Solaris, No module named _md5

2008-12-11 Thread skip
Shawn> When I "import md5", I got: ... Shawn> import _md5 Shawn> ImportError: No module named _md5 Check the output of the build process to see if the _md5 extension failed to build, and if so, dig into the setup.py file a bit. It's likely that you forgot to include the prope

Re: using distutils to cross-compile extensions?

2008-12-11 Thread Michael 'Mickey' Lauer
Michael George wrote: > I have an extension module that I've built using distutils. I wonder if > it's possible to use distutils to cross-compile it for windows on my > linux box, and whether the pain involved is great. Can anyone point me > in the right direction? Take a look at OpenEmbedde

Re: Best way of debigging a C extension

2008-12-11 Thread Paul Moore
On 11 Dec, 21:57, Christian Heimes wrote: > You have to build Python on your own to get debug builds. Only debug > builds allow to do extension debugging like memory leak finding. The trouble is, I only have mingw to build extensions, not MSVC7.1 - so I can't build Python (and I don't know if I s

Re: Preventing execution of a method

2008-12-11 Thread rdmurray
On Thu, 11 Dec 2008 at 13:41, Emanuele D'Arrigo wrote: On Dec 11, 7:48?pm, Bruno Desthuilliers wrote: or to provide read-only access. I.e. right now I'm working on the graphical client which potentially could be rewritten entirely by the users. It is necessary and perfectly reasonable for the c

Re: Best way of debigging a C extension

2008-12-11 Thread Christian Heimes
Paul Moore wrote: I have gdb (although I've hardly used it, but I can learn :-)) but if I try building my extension with python setup.py build --debug, I get an error because -lpython25_d does not exist. I'm not surprised by this, as I don't have a debug build of Python - but that should be OK, I

Python 2.5.2 error on Solaris, No module named _md5

2008-12-11 Thread Gong, Shawn (Contractor)
hi list, I tried to build Python 2.5.2 on Solaris 9 with gcc 3.4.6 under my user account. (there is already an older 2.5.1 on /usr/local/, so I used "make -I install") When I "import md5", I got: Python 2.5.2 (r252:60911, Dec 11 2008, 15:16:41) [GCC 3.4.6] on sunos5 Type "help", "copyright", "c

Re: Preventing execution of a method

2008-12-11 Thread Emanuele D'Arrigo
On Dec 11, 7:48 pm, Bruno Desthuilliers wrote: > > or to provide read-only > > access. I.e. right now I'm working on the graphical client which > > potentially could be rewritten entirely by the users. It is necessary > > and perfectly reasonable for the client module to access some of the > > obj

Re: dictionary idiom needed

2008-12-11 Thread Brandon
> >>> d = defaultdict(lambda: defaultdict(int)) > > Arnaud Ah... so that's what lambdas are for. Many thanks! Brandon -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way of debigging a C extension

2008-12-11 Thread Miki
Hello Paul, > I'm writing a C extension. My environment is Python 2.5, with the > mingw compiler, on Windows XP. At the moment I'm debugging by > scattering printf() statements around, but it's not always easy. Is > there a better way of debugging - particularly for diagnosing crashes? No guarante

Re: Problems running on HP Intel duo core machine

2008-12-11 Thread jim-on-linux
Aaron, The TraceBack is : TraceBack: File win32ui.pyc, line 12, in File win32ui.pyc Line 10, in _load ImportError: DLL Load Failed: The specified module could not be found. On Thursday 11 December 2008 14:58, jim-on-linux wrote: > py help, > > I produced a program that runs on windows. > On

Re: newbie question: if var1 == var2:

2008-12-11 Thread Kirk Strauser
At 2008-12-11T19:49:23Z, Steve Holden writes: > ... and it's so hard to write > > item = item[:-1] It's easy - and broken. Bad things happen if you're using something other than '\n' for EOL. -- Kirk Strauser The Day Companies -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems running on HP Intel duo core machine

2008-12-11 Thread Aaron Brady
On Dec 11, 1:58 pm, jim-on-linux wrote: > py help, > > I produced a program that runs on windows. > One client is using an HP machine with an Intel cpu > E2200 @ 2.2ghz., and with .99 G ram. > The machine is using Win XP Pro 32 bit OS with service > pack 2 > > I ran Dependency Walker and everythin

Re: newbie question: if var1 == var2:

2008-12-11 Thread Bruno Desthuilliers
Steve Holden a écrit : Kirk Strauser wrote: At 2008-11-29T04:02:11Z, Mel writes: You could try for item in fname: item = item.strip() This is one case where I really miss Perl's "chomp" function. It removes a trailing newline and nothing else, so you don't have to worry about losing le

Re: Problems running on HP Intel duo core machine

2008-12-11 Thread Giuseppe Di Martino
Il Thu, 11 Dec 2008 14:58:16 -0500, jim-on-linux ha scritto: > The first module that is imported is win32api. line 8 of that module > adds to the path the module named 'win32api.pyd'. > The import is is completed without error. > > The next module that is imported is win32ui. line 8 of that modul

Re: Preventing execution of a method

2008-12-11 Thread Bruno Desthuilliers
Emanuele D'Arrigo a écrit : Thank you all for the confirmation and the suggestions (including the tangential ones: I didn't know one could remove your his own posts!). As much as I really like Python (which I've been using full-time only for the past two months) I really wish it did have regular

Re: Preventing execution of a method

2008-12-11 Thread Bruno Desthuilliers
Emanuele D'Arrigo a écrit : Sorry if I'm a bit thick here... can any of the esteemed participant in this noble newsgroup Ain't that a bit over the border ?-) confirm that is not possible to prevent a python module's code from executing the methods of another module? I.e. if I have a class w

Re: dictionary idiom needed

2008-12-11 Thread Arnaud Delobelle
Brandon writes: > Thanks bear - > > Some outside advice has me looking at nested dictionaries. But I am > still bogged down because I've not created one before and all examples > I can find are simple ones where they are created manually, not with > loops. Maybe a further example: > > data: >

Re: internal circular class references

2008-12-11 Thread Ethan Furman
Thanks, Carl! Thanks, RDM! Your examples and ideas are much appreciated. Many thanks also to everyone else who responded. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Mathematica 7 compares to other languages

2008-12-11 Thread Jim Gibson
In article <5ebe5a7d-cbdf-4d66-a816-a7d2a0a27...@40g2000prx.googlegroups.com>, Xah Lee wrote: > On Dec 10, 2:47 pm, John W Kennedy wrote: > > Xah Lee wrote: > > > In lisp, python, perl, etc, you'll have 10 or so lines. In C or Java, > > > you'll have 50 or hundreds lines. > > > > C: > > > > #inc

Re: newbie question: if var1 == var2:

2008-12-11 Thread Steven D'Aprano
On Thu, 11 Dec 2008 13:44:22 -0600, Kirk Strauser wrote: > At 2008-12-11T17:24:44Z, rdmur...@bitdance.com writes: > >> >>> ' ab c \r\n'.rstrip('\r\n') >> ' ab c ' >> >>> ' ab c \n'.rstrip('\r\n') >> ' ab c ' >> >>> ' ab c '.rstrip('\r\n') >> ' ab c ' > > I did

Re: dictionary idiom needed

2008-12-11 Thread Brandon
> Smells like homework without a particular application. @Scott: Even if that were the case :) I'd still like to figure out how to create nested dictionaries! Brandon -- http://mail.python.org/mailman/listinfo/python-list

Re: dictionary idiom needed

2008-12-11 Thread Brandon
Thanks bear - Some outside advice has me looking at nested dictionaries. But I am still bogged down because I've not created one before and all examples I can find are simple ones where they are created manually, not with loops. Maybe a further example: data: POS1POS2 POS3 ['word1','tag

Re: How to know when it's possible to bind a socket on an unprivileged port?

2008-12-11 Thread Giampaolo Rodola'
Another way (probably more reliable): def bind_on_privileged_ports(): """Return True if it is possible to bind sockets on privileged ports (< 1024).""" for port in range(1, 1024)[::-1]: print port try: s = socket.socket() s.bind((HOST, port))

Re: Mathematica 7 compares to other languages

2008-12-11 Thread Brian Blais
On Dec 11, 2008, at 13:41 , Xah Lee wrote: On Dec 10, 2:47 pm, John W Kennedy wrote: Xah Lee wrote: In lisp, python, perl, etc, you'll have 10 or so lines. In C or Java, you'll have 50 or hundreds lines. C: #include #include void normal(int dim, float* x, float* a) { float sum = 0

Problems running on HP Intel duo core machine

2008-12-11 Thread jim-on-linux
py help, I produced a program that runs on windows. One client is using an HP machine with an Intel cpu E2200 @ 2.2ghz., and with .99 G ram. The machine is using Win XP Pro 32 bit OS with service pack 2 I ran Dependency Walker and everything is OK. I used py2exe to build the exe file with bun

Best way of debigging a C extension

2008-12-11 Thread Paul Moore
I'm writing a C extension. My environment is Python 2.5, with the mingw compiler, on Windows XP. At the moment I'm debugging by scattering printf() statements around, but it's not always easy. Is there a better way of debugging - particularly for diagnosing crashes? I have gdb (although I've hardl

Re: dictionary idiom needed

2008-12-11 Thread Scott David Daniels
Brandon wrote: I have a series of lists in format ['word', 'tagA', 'tagB']. I have converted this to a few dicts, such as one in which keys are tuples of ('word', 'tagB'), and the values are the number of times that key was found. Smells like homework without a particular application. --

Re: Python, threading

2008-12-11 Thread Scott David Daniels
SMALLp wrote: ... I need a tip on how to communicat4 between threads. Typically inter-thread communication is done via Queue.Queue. Look up the Queue module in your docs. a "Simple" example: import Queue shared_work = Queue.Queue() combined_replies = Queue.Queue() ... [distribu

Re: newbie question: if var1 == var2:

2008-12-11 Thread Kirk Strauser
At 2008-12-11T17:24:44Z, rdmur...@bitdance.com writes: > >>> ' ab c \r\n'.rstrip('\r\n') > ' ab c ' > >>> ' ab c \n'.rstrip('\r\n') > ' ab c ' > >>> ' ab c '.rstrip('\r\n') > ' ab c ' I didn't say it couldn't be done. I just like the Perl version better. -- K

Re: newbie question: if var1 == var2:

2008-12-11 Thread Steve Holden
Kirk Strauser wrote: > At 2008-11-29T04:02:11Z, Mel writes: > >> You could try >> >> for item in fname: >> item = item.strip() > > This is one case where I really miss Perl's "chomp" function. It removes a > trailing newline and nothing else, so you don't have to worry about losing > leadin

Re: Equivalent of 'wget' for python?

2008-12-11 Thread member thudfoo
On Mon, Dec 8, 2008 at 8:22 AM, Robert Dailey wrote: > Hi, > > I'm looking for a portable way to download ZIP files on the internet > through Python. I don't want to do os.system() to invoke 'wget', since > this isn't portable on Windows. I'm hoping the core python library has > a library for this

Re: just got the g1

2008-12-11 Thread Michael Torrie
garywood wrote: > Hi > > Just got the G1, is their any way to get python running on the andriod > platform ? Nope. But some day when other languages are supported, Python will be high on the list. In the meantime, Android is java only. And no you can't use Jython because Android statically c

Re: Mathematica 7 compares to other languages

2008-12-11 Thread Xah Lee
On Dec 11, 6:50 am, the.brown.dragon.b...@gmail.com wrote: ;; Chicken Scheme. By the.brown.dragon...@gmail.com (require 'srfi-1) (define (normalize vec) (map (cute / <> (sqrt (reduce + 0 (map (cute expt <> 2) vec vec)) Is it possible to make it work in scsh? (i'm running scsh 0.6.4, and don'

Re: Call by reference in SWIG?

2008-12-11 Thread Chris Mellon
On Thu, Dec 11, 2008 at 9:43 AM, Joe Strout wrote: > On Dec 10, 2008, at 10:19 PM, Nok wrote: > >> I can't get call-by-reference functions to work in SWIG... > > Python doesn't have any call-by-reference support at all [1], so I'm not > surprised that a straight translation of the call-by-referenc

Re: internal circular class references

2008-12-11 Thread rdmurray
On Thu, 11 Dec 2008 at 09:33, Ethan Furman wrote: Carl Banks wrote: On Dec 10, 5:26 pm, Ethan Furman wrote: First of all, do you even need to wrap the datetime.date class? With Python's duck typing ability, you could have a separate NullDate class to go alongside the datetime.date, and use

Re: Preventing execution of a method

2008-12-11 Thread Emanuele D'Arrigo
Thank you all for the confirmation and the suggestions (including the tangential ones: I didn't know one could remove your his own posts!). As much as I really like Python (which I've been using full-time only for the past two months) I really wish it did have regular private/ protected/public met

Re: Find Files in a Folder Between 2 Dates

2008-12-11 Thread Gregory Plantaine
On Dec 5, 3:14 pm, John Machin wrote: > On Dec 6, 9:41 am, GregoryPlantaine wrote: > > > That worked perfectly! > > > Thanks Tim! > > > Since we can print the files, does that mean the list of files is in a > > tuple, or something?  Would there be a way to further split up the > > file names? > >

Re: get todays files

2008-12-11 Thread Andrew Doades
Tim Chase wrote: I know this will sound like I am being very cheeky, but is there a way you can make this for where the ftp server is actually windows server? For Windows Server, I don't have a Windows FTP server to test with -- I've got the company Linux server, and the previous testing si

Re: internal circular class references

2008-12-11 Thread Carl Banks
On Dec 11, 11:33 am, Ethan Furman wrote: > Good question.  My goal with NullDate is to have a date object that I > can treat the same regardless of whether or not it actually holds a > date.  NullDates with no value should sort before any NullDates with a > value, should be comparable to dates as

Re: get todays files

2008-12-11 Thread Tim Chase
I know this will sound like I am being very cheeky, but is there a way you can make this for where the ftp server is actually windows server? For Windows Server, I don't have a Windows FTP server to test with -- I've got the company Linux server, and the previous testing site I used (I think I

Re: How to know when it's possible to bind a socket on an unprivileged port?

2008-12-11 Thread Giampaolo Rodola'
On 11 Dic, 19:09, "Giampaolo Rodola'" wrote: > Hi, > For a purpose of testing I need a function which could tell me whether > it is possible to bind sockets on privileged ports or not. > I wrote down this simple function. It seems reasonably working to me > but I'd like to hear your opinion first.

Re: Python to open command script file

2008-12-11 Thread Mike Driscoll
On Dec 11, 12:04 pm, dave rose wrote: > Hello all >  I would like to know how to do the following.  I'd like to have a generic > python program that the user will open a command-script file to do actions. > > So, my python program will get a list of servers, enumerate them within a > checklistbox

  1   2   >