Re: Noob questions about Python

2007-10-17 Thread hg
Ixiaus wrote:

> I have recently (today) just started learning/playing with Python. So
> far I am excited and impressed (coming from PHP background).
> 
> I have a few questions regarding Python behavior...
> 
> val = 'string'
> li = list(val)
> print li.reverse()
> 
> returns nothing, but,
> 
> val = 'string'
> li = list(val)
> li.reverse()
> print li
> 
> returns what I want. Why does Python do that?
> 
> Also I have been playing around with Binary math and noticed that
> Python treats:
> 
> val = 00110
> 
> as the integer 72 instead of returning 00110, why does Python do that?
> (and how can I get around it?)
> 
> Grateful for any replies!

li.reverse does not return a list but reverses the list itself and return
Noe

0xxx tells python that you work in octal.

hg




-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Guitars for 0$ !!!!!

2007-09-27 Thread hg
 [EMAIL PROTECTED] wrote:

> http://free-guitars.blogspot.com/

And the chicks for free !
-- 
http://mail.python.org/mailman/listinfo/python-list


ANN: Load binary application into a BasiCard from Python

2007-09-08 Thread hg
Hi,

Based on the already released SCF, the code is there:
http://snakecard.com/Source/Applications/SCF/Load_BC.zip.

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: SCF released to GPL

2007-08-27 Thread hg
hg wrote:
> Méta-MCI (MVP) wrote:
>> Salut !
>>
>> Le deuxième envoi aurait pu être en français.
>> Cela aurait évité le doublon, tout en maintenant le message.
>>
>> @+
>>
>> Michel Claveau
>>
> 
> ;-)
> 
> No:
> 1) The redundancy is due to the fact that I just moved to another 
> state/ISP and that ... for some reason, the initial post did not show 
> for quite some times.
> 
> 2) I'm desperately searching for the French NG from my client but cannot 
> find it ... any clue ? Maybe you can pass the message ?
> 
> hg
PS: I know this is not a python issue.
can someone out there using news.sf.sbcglobal.net see fr.comp.lang.python ?

could the name be different ?

Thanks,

hg
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: SCF released to GPL

2007-08-27 Thread hg
Méta-MCI (MVP) wrote:
> Salut !
> 
> Le deuxième envoi aurait pu être en français.
> Cela aurait évité le doublon, tout en maintenant le message.
> 
> @+
> 
> Michel Claveau
> 

;-)

No:
1) The redundancy is due to the fact that I just moved to another 
state/ISP and that ... for some reason, the initial post did not show 
for quite some times.

2) I'm desperately searching for the French NG from my client but cannot 
find it ... any clue ? Maybe you can pass the message ?

hg
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: SCF released GPL

2007-08-26 Thread hg
Alex Martelli wrote:
> hg <[EMAIL PROTECTED]> wrote:
>...
>> I am looking for a free subversion server resource to put the code ...
>> if you know of any.
> 
> Check out code.google.com -- it has a hosting service for open source
> code, too, these days (and it IS subversion).
> 
> 
> Alex

Will look it up ... thanks.

hg
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: SCF released to GPL

2007-08-26 Thread hg
hg wrote:
> Dear all,
> 
> I am releasing much of my work including SCF (Cross platform Smart Card
> library & Tools written in Python) to the GPL license.
> 
> If interested, go to http://www.SnakeCard.com/Source.html
> 
> I am moving the doc to doxygen and cleaning up the code, so what you'll see
> there will change in the course of the next few weeks - basically can only
> get meaningful info on the classes hierarchy at this stage.
> I am looking for a free subversion server resource to put the code ... if
> you know of any.
> 
> Some of the work there will be windows-only related (GINA, activeX
> components ... and not coded in Python) and the applets JavaCard and
> BasicCard ... I'm releasing these during the next few days.
> 
> Regards,
> 
> hg 
PS: I apologize for the "spam" ... I just changed ISP .. and my initial 
post did not make it (or so I thought) ... sorry.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: SCF released GPL

2007-08-26 Thread hg
Paul Rubin wrote:
> hg <[EMAIL PROTECTED]> writes:
>> I am looking for a free subversion server resource to put the code
>> ... if you know of any.
> 
> Does it have to be SVN?  I think Savannah and Sourceforge both still
> use CVS.  I'm not sure what Launchpad uses.  I guess if necessary I
> could set up a subversion repo for you on a server that I use.  I've
> been wanting to put together some GNU security tools under the name
> Fort GNOX, so maybe this can be a start.

Nope CVS would be fine ... I guess I've made the switch in my head.

I'll check SourceForge.

Thanks.

hg


-- 
http://mail.python.org/mailman/listinfo/python-list


ANN: SCF released to GPL

2007-08-26 Thread hg
Dear all,

I am releasing much of my work including SCF (Cross platform Smart Card
library & Tools written in Python) to the GPL license.

If interested, go to http://www.SnakeCard.com/Source.html

I am moving the doc to doxygen and cleaning up the code, so what you'll see
there will change in the course of the next few weeks - basically can only
get meaningful info on the classes hierarchy at this stage.
I am looking for a free subversion server resource to put the code ... if
you know of any.

Some of the work there will be windows-only related (GINA, activeX
components ... and not coded in Python) and the applets JavaCard and
BasicCard ... I'm releasing these during the next few days.

Regards,

hg 
-- 
http://mail.python.org/mailman/listinfo/python-list


ANN: SCF released GPL

2007-08-26 Thread hg
Dear all,

I am releasing much of my work including SCF (Cross platform Smart Card 
library & Tools written in Python) to the GPL license.

If interested, go to http://www.SnakeCard.com/Source.html

I am moving the doc to doxygen and cleaning up the code, so what you'll 
see there will change in the course of the next few weeks - basically 
can only get meaningful info on the classes hierarchy at this stage.
I am looking for a free subversion server resource to put the code ... 
if you know of any.

Some of the work there will be windows-only related (GINA, activeX 
components ... and not coded in Python) and the applets JavaCard and 
BasicCard ... I'm releasing these during the next few days.

Regards,

hg
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: SCF (Python Smar Card Framework)

2007-08-26 Thread hg
Paul Rubin wrote:
> hg <[EMAIL PROTECTED]> writes:
>> I am releasing much of my work including SCF (Cross platform Smart
>> Card library & Tools) to the GPL license.
>>
>> If interested, go to http://www.SnakeCard.com/Source.html
> 
> Wow, that is great.  I haven't found any low cost programmable cards
> (no large quantity purchases or developer licenses needed) other than
> BasicCard which has some annoying limitations.  Do you have any
> suggestions?  Thanks!
> 

How about you post that on the forum I just opened ... we're going to 
get killed here ;-)

hg
-- 
http://mail.python.org/mailman/listinfo/python-list


SCF (Python Smar Card Framework)

2007-08-26 Thread hg
Dear all,

I am releasing much of my work including SCF (Cross platform Smart Card 
library & Tools) to the GPL license.

If interested, go to http://www.SnakeCard.com/Source.html

I am moving the doc to doxygen and cleaning up the code, so what you'll 
see there will change in the course of the next few weeks - basically 
can only get meaningful info on the classes hierarchy at this stage.
I am looking for a free subversion server resource to put the code ... 
if you know of any.

Some of the work there will be windows-only related (GINA, activeX 
components ...) and the applets JavaCard and BasicCard ... I'm releasing 
these during the next few days.

Regards,

Philippe
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Emacs + python

2007-08-07 Thread hg
Ben Finney wrote:

> hg <[EMAIL PROTECTED]> writes:
> 
>> how about a cscope equivalent ?
> 
> How about reading what was posted earlier in the thread, and give us a
> description of what you want instead of a name that people might not
> recognise?
> 
> --
>  \  "The judge asked, 'What do you plead?' I said, 'Insanity, your |
>   `\ honour. Who in their right mind would park in the passing |
> _o__)lane?'"  -- Steven Wright |
> Ben Finney

Cscope allows for instance to find the definition of a symbol.

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Eclipse/PyDev question.

2007-08-03 Thread hg
king kikapu wrote:

> Hi,
> this is actually a question to those of us who use Eclipse and Pydev
> as their main Python developing environment. As i use Eclipse (3.3
> Europa) only for Python and i have nothing to do with Java, is there a
> way to disable/uninstall some Java-specific stuff and make the
> environment actually more snappy ??
> 
> thanks for any help
I like pydev and purchased the extensions ... there are bugs of course but
what stopped me from using it is a project were I had some very large files
(my fault).

I stopped using it and went for wing dev (I need Windows and Linux access)
and "there are bugs of course" ... but it is snappier.

I still like pydev and will try it again ... once I can afford a faster PC /
or have the time to re-factor my code.


PS: I just got today news about a "free" version of wing dev .. .worth the
try.

hg


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Emacs + python

2007-08-03 Thread hg
Greg Donald wrote:

> On 8/1/07, hg <[EMAIL PROTECTED]> wrote:
>> Are there any cscope & ECB equivalent for Python ?
> 
> ECB is not language specific.  It works the same for browsing Python
> code as any other language.
> 
> 
> --
> Greg Donald
> http://destiney.com/

Thanks, I realized my mistake soon after I posted ... how about a cscope
equivalent ?

hg


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Emacs + python

2007-08-01 Thread hg
Edward O'Connor wrote:

>> Could anyone put me on the right track to developing Python with emacs
>> please : modes to consider, debugging etc hopefully all within emacs.
> 
> Personally, I prefer the python.el that ships with Emacs 22 to the
> python-mode.el from python.org. It seems more like other Emacs major
> modes.
> 
> 
> Ted
> 
> --
> Edward O'Connor
> [EMAIL PROTECTED]
> 
> Ense petit placidam sub libertate quietem.

Are there any cscope & ECB equivalent for Python ?

Thanks 

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wing IDE for Python v. 3.0 beta1 released

2007-08-01 Thread hg
Fuzzyman wrote:

> On Aug 2, 1:46 am, "Greg Donald" <[EMAIL PROTECTED]> wrote:
>> On 8/1/07, John K Masters <[EMAIL PROTECTED]> wrote:
>>
>> > If their support for paid customers is anything like their support for
>> > prospective customers then I would leave well alone.
>>
>> I had no problems with their support whatsoever, really good in my
>> opinion.  They were very responsive and addressed all my questions
>> over about a 3 or 4 day email conversation.
>>
>> --
>> Greg Donaldhttp://destiney.com/
> 
> I'll third that. I have had excellent and extended support from the
> Wing guys. Definitely recommended.
> 
> Fuzzyman
> http://www.voidspace.org.uk/python/articles.shtml

I sent a bug report 10 minutes ago and already have received an answer with
a possible way out !

hg


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Can a low-level programmer learn OOP?

2007-07-17 Thread hg
Chris Carlen wrote:

> Hi:
> 
>  From what I've read of OOP, I don't get it.  I have also found some
> articles profoundly critical of OOP.  I tend to relate to these articles.
> 
> However, those articles were no more objective than the descriptions of
> OOP I've read in making a case.  Ie., what objective
> data/studies/research indicates that a particular problem can be solved
> more quickly by the programmer, or that the solution is more efficient
> in execution time/memory usage when implemented via OOP vs. procedural
> programming?
> 
> The problem for me is that I've programmed extensively in C and .asm on
> PC DOS way back in 1988.  Then didn't program for nearly 10 years during
> which time OOP was popularized.  Starting in 1999 I got back into
> programming, but the high-level-ness of PC programming and the
> completely foreign language of OOP repelled me.  My work was in analog
> and digital electronics hardware design, so naturally I started working
> with microcontrollers in .asm and C.  Most of my work involves low-level
> signal conditioning and real-time control algorithms, so C is about as
> high-level as one can go without seriously loosing efficiency.  The
> close-to-the-machine-ness of C is ideal here.  This is a realm that I
> truly enjoy and am comfortable with.
> 
> Hence, being a hardware designer rather than a computer scientist, I am
> conditioned to think like a machine.  I think this is the main reason
> why OOP has always repelled me.
> 
> Perhaps the only thing that may have clicked regarding OOP is that in
> certain cases I might prefer a higher-level approach to tasks which
> involve dynamic memory allocation.  If I don't need the execution
> efficiency of C, then OOP might produce working results faster by not
> having to worry about the details of memory management, pointers, etc.
> 
> But I wonder if the OOP programmers spend as much time creating classes
> and trying to organize everything into the OOP paradigm as the C
> programmer spends just writing the code?
> 
> Ultimately I don't care what the *name* is for how I program.  I just
> need to produce results.  So that leads back to objectivity.  I have a
> problem to solve, and I want to find a solution that is as quick as
> possible to learn and implement.
> 
> Problem:
> 
> 1.  How to most easily learn to write simple PC GUI programs that will
> send data to remote embedded devices via serial comms, and perhaps
> incorporate some basic (x,y) type graphics display and manipulation
> (simple drawing program).  Data may result from user GUI input, or from
> parsing a text config file.  Solution need not be efficient in machine
> resource utilization.  Emphasis is on quickness with which programmer
> can learn and implement solution.
> 
> 2.  Must be cross-platform: Linux + Windows.  This factor can have a big
> impact on whether it is necessary to learn a new language, or stick with
> C.  If my platform was only Linux I could just learn GTK and be done
> with it.  I wouldn't be here in that case.
> 
> Possible solutions:
> 
> Form 1:  Use C and choose a library that will enable cross-platform GUI
> development.
> 
> Pro:  Don't have to learn new language.
> Con:  Probably will have difficulty with cross-platform implementation
> of serial comms.  This will probably need to be done twice.  This will
> waste time.
> 
> Form 2:  Use Python and PySerial and TkInter or wxWidgets.
> 
> Pro:  Cross-platform goal will likely be achieved fully.  Have a
> programmer nearby with extensive experience who can help.
> Con:  Must learn new language and library.  Must possibly learn a
> completely new way of thinking (OOP) not just a new language syntax.
> This might be difficult.
> 
> Form 3:  Use LabVIEW
> 
> Pro:  I think that the cross-platform goal can be met.
> Con:  Expensive.  I would prefer to use an Open Source solution.  But
> that isn't as important as the $$$.  I have also generally found the 2D
> diagrammatical programming language of "G" as repelling as OOP.  I
> suspect that it may take as much time to learn LabVIEW as Python.  In
> that case the time spent on Python might be better spent since I would
> be learning something foundational as opposed to basically just learning
> how to negotiate someone's proprietary environment and drivers.
> 
> 
> Comments appreciated.
> 
> 
> --
> Good day!
> 
> 
> Christopher R. Carlen
> Principal Laser&Electronics Technologist
> Sandia National Laboratories CA USA
> [EMAIL PROTECTED]
> NOTE, delete texts: "RemoveThis" and
> "BOGUS" from email address to reply.


yes, maybe you should look at UML first.

hg


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ctype and functions that return a pointer to a structure

2007-07-01 Thread hg
Lenard Lindstrom wrote:

> hg wrote:
>> Hi,
>> 
>> I have the following code:
>> **
>> from ctypes import *
>> g_lib = cdll.LoadLibrary("libc.so.6")
>> class Struct_Password(Structure):
>> """
>>  
>> """
>> _fields_ = [ ('name', c_char_p),
>> ('code', c_char_p),
>> ('date', c_long),
>> ('min',  c_long),
>> ('max',  c_long),
>> ('warn', c_long),
>> ('inact', c_long),
>> ('expire', c_long),
>> ('flag', c_ulong)
>> ]
>> l_res =  g_lib.getspnam('john')
>> l_struct = cast(l_res, POINTER( Struct_Password() ) )
> 
> l_struct = cast(l_res, POINTER( Struct_Password ) )
> 
> POINTER wants a ctypes type as an argument. Struct_Password() is a
> Structure instance.
> 
> A better way to do it is define the return type for getspnam:
> 
> g_lib.getspnam.restype = POINTER( Struct_Password )
> 
> Now the function returns a structure pointer so the cast is unnecessary.
> 
> ---
> Lenard Lindstrom
> <[EMAIL PROTECTED]>

Many thanks,

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


ctype and functions that return a pointer to a structure

2007-07-01 Thread hg
Hi,

I have the following code:
**
from ctypes import * 
g_lib = cdll.LoadLibrary("libc.so.6")
class Struct_Password(Structure): 
""" 
 
""" 
_fields_ = [ ('name', c_char_p), 
('code', c_char_p), 
('date', c_long), 
('min',  c_long), 
('max',  c_long), 
('warn', c_long), 
('inact', c_long), 
('expire', c_long), 
('flag', c_ulong) 
]
l_res =  g_lib.getspnam('john') 
l_struct = cast(l_res, POINTER( Struct_Password() ) ) 
print l_struct
**

The exception I get is "unhashable type" - apparently cast only handles
simple types.

Is there a way to convert l_res to Struct_Password ?

Thanks,

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python app as a Display Manager

2007-07-01 Thread hg
"Martin v. Löwis" wrote:

>> I feel at this stage that what I miss is: assuming I manage to get a
>> python-based dialog box started automatically from init.rc (instead of
>> xdm, gdm, ...): how do I start an X11 session with the user/pw
>> information retrieved ... + set the correct *nix environment variables.
> 
> First, the user will enter username and password into your dialog box.
> You need to verify this, either by using the pwd module, or by using PAM
> (through python-pam).
> 
> Then you need start a session. Fork a subprocess, and use setuid/setgid
> to take the identity of the subprocess. In the parent process, wait for
> this child process to terminate, then display your dialog again (perhaps
> restarting the X server in-between).
> 
> What you do in your session is your own choice. It is custom to set a
> few environment variables, and then run /etc/X11/Xsession (or whereever
> the standard X11 session script lives); the latter is done through exec,
> i.e. when Xsession returns, the user has chosen to logout.
> 
> This is the basic working principle; different display managers deviate
> in how precisely they setup the session, and what precisely they run in
> what order.
> 
> However, this entire discussion is off-topic for comp.lang.python;
> please ask on comp.windows.x instead.
> 
> HTH,
> Martin

Martin,

Many many thanks, I did post here also so someone would tell me whether
using Python was feasible or not for this project (ex, having tkinter or
wxPython running prior t oan actual X11 session). Also I did not know about
comp.windows.x.

Regards,

hg


-- 
http://mail.python.org/mailman/listinfo/python-list


Python app as a Display Manager

2007-06-30 Thread hg
Hi,

I asked that question a while back ... and then gave up:

I want to write a simple display manager (*nix / X11) in Python.

I'm going through lots of documentation as well as the code of XDM.

1) I currently understand that the "X11 Intrinsics" are what I need to
master in order to get there.

2) Also, it seems that The Python app needs to adjust to X11 callbacks ...
although I will use TKinter or another Framework to actually do the
drawing.

I feel at this stage that what I miss is: assuming I manage to get a
python-based dialog box started automatically from init.rc (instead of xdm,
gdm, ...): how do I start an X11 session with the user/pw information
retrieved ... + set the correct *nix environment variables.


Can you direct me some info / give me a clue ?

Many thanks,

hg



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a wxPython GUI builder

2007-06-16 Thread hg
Dick Moores wrote:

> How about SPE?
> 
> Any others?
> 
> And which ones do people
> actually use? Commercial or Freeware.
> 
> Thanks,
> 
> Dick Moores


I use wxDesigner: http://www.roebling.de/

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: stdout/err and C extentions

2007-06-12 Thread hg
Robert Bauck Hamar wrote:

> hg wrote:
> 
>> Robert Bauck Hamar wrote:
>> 
>>> hg wrote:
>>> 
>>>> Hi,
>>>> 
>>>> I have the following
>>>> 
>>>> * C extention  - redir.c
>>>> 
>>>> 
>>>> #include "Python.h"
>>>> 
>>>> PyObject * test_redir_test(PyObject *self) {
>>>>   fprintf(stdout, "Hello from an extention!\n");
>>>>   Py_INCREF(Py_None);
>>>>   return Py_None;
>>>> }
>>>> 
>>> [...]
>>>> *** python test script: test.py:
>>>> import sys
>>>> 
>>>> 
>>>> class My_Stdout:
>>>> def write(self, p_string):
>>>> l_file = open('res.txt','a')
>>>> l_file.write(p_string)
>>>> l_file.close
>>>> 
>>>> 
>>>> sys.stdout = My_Stdout()
>>>> 
>>>> print 'toto'
>>>> import test_redir
>>>> 
>>>> 
>>>> 
>>>> test_redir.test()
>>>> 
>>>> 
>>>> 
>>>>  Question:
>>>>  
>>>> print 'toto' does go to "res.txt" while "Hello from an extention!\n"
>>>> goes to the console.
>>>> 
>>>> Any clue ?
>>> 
>>> There is no portable way to change the location of stdout during
>>> execution of a program. If you want to print with whatever is sys.stdout
>>> from an extension module, you should call sys.stdout's write method
>>> dynamically from C.
>>> 
>> 
>> Robert, thanks,
>> 
>> I understand that sys.stdout and stdout of an extention are two different
>> entities ... correct ?
> 
> Yes. Python's sys.stdout and C's stdout are both objects wrapping the call
> os.write(1, "string") in Python and write(1, "string", strlen("string"))
> in C, or some other function on platforms using other mechanisms for
> output.
> 
> In that way sys.stdout in Python and stdout in C will be portable to many
> more systems.
> 
> --
> Robert Bauck Hamar


Thanks Robert.

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: stdout/err and C extentions

2007-06-12 Thread hg
Robert Bauck Hamar wrote:

> hg wrote:
> 
>> Hi,
>> 
>> I have the following
>> 
>> * C extention  - redir.c
>> 
>> 
>> #include "Python.h"
>> 
>> PyObject * test_redir_test(PyObject *self) {
>>   fprintf(stdout, "Hello from an extention!\n");
>>   Py_INCREF(Py_None);
>>   return Py_None;
>> }
>> 
> [...]
>> *** python test script: test.py:
>> import sys
>> 
>> 
>> class My_Stdout:
>> def write(self, p_string):
>> l_file = open('res.txt','a')
>> l_file.write(p_string)
>> l_file.close
>> 
>> 
>> sys.stdout = My_Stdout()
>> 
>> print 'toto'
>> import test_redir
>> 
>> 
>> 
>> test_redir.test()
>> 
>> 
>> 
>>  Question:
>>  
>> print 'toto' does go to "res.txt" while "Hello from an extention!\n" goes
>> to the console.
>> 
>> Any clue ?
> 
> There is no portable way to change the location of stdout during execution
> of a program. If you want to print with whatever is sys.stdout from an
> extension module, you should call sys.stdout's write method dynamically
> from C.
> 
> --
> Robert Bauck Hamar


Robert, thanks,

I understand that sys.stdout and stdout of an extention are two different
entities ... correct ?


hg


-- 
http://mail.python.org/mailman/listinfo/python-list


stdout/err and C extentions

2007-06-12 Thread hg
Hi,

I have the following

* C extention  - redir.c


#include "Python.h"

PyObject * test_redir_test(PyObject *self) {
  fprintf(stdout, "Hello from an extention!\n");
  Py_INCREF(Py_None);
  return Py_None;
}

static PyMethodDef test_redir_methods[] = {
{"test", (PyCFunction)test_redir_test, METH_NOARGS, "Prints test string
\n"},
{NULL, NULL, 0, NULL}
};

DL_EXPORT(void) inittest_redir(void)
{
Py_InitModule3("test_redir", test_redir_methods, "Provides a test
function.\n");   
}

* setup.py :

from distutils.core import setup, Extension
import sys
import os 


include = []



setup(name="test_redir", version="0.1",
   ext_modules=[
   Extension(
   "test_redir",
["redir.c"],
undef_macros=['RELEASE'],
library_dirs=[],
)
]
)

*** python test script: test.py:



import sys


class My_Stdout:
def write(self, p_string):
l_file = open('res.txt','a')
l_file.write(p_string)
l_file.close


sys.stdout = My_Stdout()

print 'toto'
import test_redir



test_redir.test()



**** Question:


print 'toto' does go to "res.txt" while "Hello from an extention!\n" goes to
the console.




Any clue ?


Thanks,


hg



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pyexe "format"

2007-06-10 Thread hg
John Machin wrote:

> On Jun 10, 11:25 am, John Machin <[EMAIL PROTECTED]> wrote:
>> On Jun 10, 10:38 am, hg <[EMAIL PROTECTED]> wrote:
>>
>> > hg wrote:
>> > > Hi,
>>
>> > > Is there a clean way to figure out that a .exe was actually generated
>> > > by pyexe ?
>>
>> > > hg
>>
>> > I should gave writtent "definite" instead of "clean"
>>
>> > hg
>>
>> Reminds me of the story about a teacher trying to correct a student
>> who was using rather dialectal English:
>>You have went and putten "putten" when you should of putten "put"!
>> :-)
>>
>> You should of looken at this:
>>
>> http://www.py2exe.org/index.cgi/WhereAmI
>>
>> HTH,
>> John
> 
> I presumed that you were really asking: "How can Python code tell
> whether it is being run in a py2exe-generated exe, or by the Python
> interpreter?".
> 
> Alternatively, "How can a human inspect an exe and determine whether
> it was generated by py2exe?": (1) I don't know (2) Why do you care?
> 
> Cheers,
> John


An ex-partner might "by mistake" be in possession of some of my source
code ... so if this source code happens to be repackaged in a .exe and I
get to audit it ... I'd like to know where to start.

So the above link ... which I had read ... does not help me.

Regards,

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pyexe "format"

2007-06-09 Thread hg
hg wrote:

> Hi,
> 
> Is there a clean way to figure out that a .exe was actually generated by
> pyexe ?
> 
> hg

I should gave writtent "definite" instead of "clean"

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


pyexe "format"

2007-06-09 Thread hg
Hi,

Is there a clean way to figure out that a .exe was actually generated by
pyexe ?

hg


-- 
http://mail.python.org/mailman/listinfo/python-list


Python 2.5 and stdin

2007-06-03 Thread hg
Hi,

I have upgraded to 2.5 and one of my program no longre functions:

In a thread run function, I attempts to get a "raw_input('')" and get the
error
***
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python2.5/threading.py", line 460, in __bootstrap
self.run()
  File "/usr/local/games/RealTimeBattle/Robots/pyrobot.py", line 89, in run
l_res = raw_input('')
IOError: [Errno 11] Resource temporarily unavailable
***

The full source code is here: http://snakecard.com/rtb/


Any clue ?

Thanks,

hg




-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Real Time Battle and Python

2007-05-04 Thread hg
Matimus wrote:

> On May 3, 5:20 am, hg <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> I have started to work on a python-based robot, and am interested in your
>> feedback:
>>
>> http://realtimebattle.sourceforge.net/www.snakecard.com/rtb
>>
>> hg
> 
> This is not necessarily a response to your effort, but just a note
> (rant) about realtimebattle. It reminds me more of homework in 300 and
> 400 level college engineering classes than a game. Based upon my
> previous effort and realizations, I found realtimebattle coding to be,
> from a programming perspective, an exercise in protocol implementation
> first. Once the protocol work is done you need to implement control
> algorithms for movement and enemy tracking. Think PID algorithms
> (Proportional, Integral and Differential). Only when the protocol and
> control portions are done can you focus on strategy and play the game.
> You should also note, however, that the first two tasks are quite
> daunting. And the second is difficult to get right. I found the whole
> process to be very tiring and not very rewarding.  I don't mean to
> discourage you, I just think it would be more fun to write my own game
> than to 'play' that one.
> 
>  A better game, from a programming perspective, would be
> "discretetimebattle". Where each player controls their robot with
> second order parameters (velocity not force), the world has no third
> order effects (friction) and the time is discrete. Discrete time
> meaneing that the protocol  updates every player at regular intervals
> with the same information and, in terms of the simulation, each update
> represents a set time delta.
> 
> I would be interested to know if anybody else has played, or tried to
> play, realtimebattle and has similar sentiments.
> 
> I do wish you luck though. If you get a robot working you are a far
> more dedicated and patient individual than me.
> 
> -Matt


I do try to separate the "engine" from the "driver". Yes the engine is a
pain to code and the documentation quite skimpy (have to got through C
headers to understand the command set) ... still I'll try to finish it.

hg


-- 
http://mail.python.org/mailman/listinfo/python-list


Real Time Battle and Python

2007-05-03 Thread hg
Hi,

I have started to work on a python-based robot, and am interested in your
feedback: 

http://realtimebattle.sourceforge.net/
www.snakecard.com/rtb


hg


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Which are your favorite UML tools?

2007-04-26 Thread hg
Anastasios Hatzis wrote:

> Hello,
> 
> I'm working on the light-weight MDA tool pyswarm,
> http://pyswarm.sourceforge.net/ (it is about a code-generator for
> Python/PostgreSQL-based software. I plan to add support of UML CASE tools
> other than the one supported currently.
> 
> I would like to learn which UML tools you use (if any), preferrably if it
> comes to modeling a Python application. So I'm asking you to tell me the
> name of your favorite UML CASE tool(s).
> 
> Please also provide the version of the tool you use (and perhaps also the
> URL of the project/vendor). If this is not of general interest for this
> list you can also reply directly to my email address.
> 
> Thank you in advance.
> 
> Best regards
> Anastasios

umbrello seems to finally have python import support 

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Where did my post go?

2007-04-25 Thread hg
[EMAIL PROTECTED] wrote:

> 
> I posted to this newsgroup earlier about my annoyances with python and
> now I can't find the post. What did you do with it?

they found it annoying and removed it.

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pyserial ... timeout on write

2007-04-23 Thread hg
hg wrote:

> Hi,
> 
> I notice that pyserial will hang on a write (even with timeout on) if
> rts/cts are one.
> 
> Anyway to get around that ?
> 
> Thanks
> 
> hg


PS: on windows

-- 
http://mail.python.org/mailman/listinfo/python-list


pyserial ... timeout on write

2007-04-23 Thread hg
Hi,

I notice that pyserial will hang on a write (even with timeout on) if
rts/cts are one.

Anyway to get around that ?

Thanks

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pickled object, read and write..

2007-04-22 Thread hg
[EMAIL PROTECTED] wrote:

> Hi all.
> 
> I have to put together some code that reads high scores from a saved
> file, then gives the user the opportunity to add their name and score
> to the high scores list, which is then saved.
> 
> Trouble is, I can't tell the program to read a file that doesn't
> exist, that generates an error.
> 
> So I must have a file created, problem HERE is everytime the program
> is run, it will overwrite the current list of saved high scores.
> 
> Advice would be much appreciated.


You can run this small script a few times to see that the file does not get
deleted

hg

import shelve


class Grades:
def __init__(self):
self.GRADES = 'GRADES'
self.m_gdb = shelve.open('MYGRADES.dat')

try:
self.m_grades = self.m_gdb[self.GRADES]
except:
self.m_grades = []
self.m_gdb[self.GRADES] = self.m_grades

self.m_gdb.close()

def Add(self, p_grade):
self.m_gdb = shelve.open('MYGRADES.dat')
self.m_grades.append(p_grade)
self.m_gdb[self.GRADES] = self.m_grades
self.m_gdb.close()

def Grades(self):
return self.m_grades

l_o = Grades()
print l_o.Grades()
l_o.Add(10)
print l_o.Grades()
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do other Python GUI toolkits require this? (OT)

2007-04-20 Thread hg
Roel Schroeven wrote:

> Hendrik van Rooyen schreef:
>>  "Steve Holden" <[EMAIL PROTECTED]> wrote:
>> 
>>  
>>> Perhaps in Belgium they prefer climbing mountains over walking up and
>>> down gentle hills?
>> 
>> Mountains ?   Hills ?   In Belgium ??
>> 
>> Its not called the battlefield of Europe for nothing...
> 
> I'm not sure if this adds anything of interest (well actually I'm pretty
> sure it doesn't), but our king Albert I was a fanatic mountain climber,
> until he died from a fall in 1934.
> 
> --
> If I have been able to see further, it was only because I stood
> on the shoulders of giants.  -- Isaac Newton
> 
> Roel Schroeven

You never know ... was it a 'steep curve' ?

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Syntax error

2007-04-17 Thread hg
Marc 'BlackJack' Rintsch wrote:

> In <[EMAIL PROTECTED]>, hg wrote:
> 
>> I had the customer comment out the first two lines of the file:
>> 
>> """
>> #!/bin/env python
>> # -*- coding: iso-8859-15 -*-
>> """
>> 
>> ... and the problem disappeared.
>> 
>> I am at a loss.
>> 
>> Any clue ?
> 
> There was once a bug in Python that lead to such "errors" if an encoding
> comment was used.  So your costumer might check his Python version and
> maybe he should update.
> 
> Ciao,
> Marc 'BlackJack' Rintsch

Thanks,

The troubling part is that I package python in the release ... but I'll
check anyway.

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Syntax error

2007-04-17 Thread hg
Diez B. Roggisch wrote:

> hg wrote:
> 
>> Hi,
>> 
>> I've had this problem in the past and still cannot fully understand.
>> 
>> I latelly passed my source code in Wing IDE wihch asked be to resolve
>> tab/space/CRLF conflicts and I said yes (initially the code was
>> developped under Linux ... and now all source got tabs replaced by spaces
>> and all EOL when switched to Windows CR/LF)
>> 
>> I sent a new release of the software, tested here first, to the customer
>> who got a syntax error on a line which visibly did not have any error.
>> 
>> retyping that line by and made the error jump around the file like crazy.
>> 
>> I had the customer comment out the first two lines of the file:
>> 
>> """
>> #!/bin/env python
>> # -*- coding: iso-8859-15 -*-
>> """
>> 
>> ... and the problem disappeared.
>> 
>> I am at a loss.
>> 
>> Any clue ?
> 
> Without a stacktrace? It's spring, not crystal ball season.
> 
> Diez


Not worth showing really, it's a screen dump so can't put it here but:


self.T_CARD_FOUND = 'PLEASE WAIT ...'
   ^
  Syntax error

hg
 




-- 
http://mail.python.org/mailman/listinfo/python-list


Syntax error

2007-04-17 Thread hg
Hi,

I've had this problem in the past and still cannot fully understand.

I latelly passed my source code in Wing IDE wihch asked be to resolve
tab/space/CRLF conflicts and I said yes (initially the code was developped
under Linux ... and now all source got tabs replaced by spaces and all EOL
when switched to Windows CR/LF)

I sent a new release of the software, tested here first, to the customer who
got a syntax error on a line which visibly did not have any error.

retyping that line by and made the error jump around the file like crazy.

I had the customer comment out the first two lines of the file:

"""
#!/bin/env python
# -*- coding: iso-8859-15 -*-
"""

... and the problem disappeared.

I am at a loss.

Any clue ?

Thanks

hg
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pyserial example program error: win32file.SetupComm reports 'Incorrect function.'

2007-04-07 Thread hg
Dennis Lee Bieber wrote:

> On Sat, 07 Apr 2007 11:36:05 +0200, hg <[EMAIL PROTECTED]> declaimed the
> following in comp.lang.python:
> 
>> 
>> I am now facing your problem ... on a machine that used to work fine.
>> 
>> Have you figured it out ?
>> 
>> Could it be a conflict between pyserial and pywin32 ?
>>
> 
> The test still runs on my system -- which is still running the
> ActiveState 2.4.3 build*... So that probably clears M$ of any
> malfeasance (via various and sundry patches).
> 
> The closest a google search came up with was someone trying to
> control a serial port printer getting failures on setupcomm (and /not/
> via Python). I think the gist was that any port except the one the
> printer was connected to was okay.
> 
> So... Is there some device connected to the port in question?
> Possibly a device that has a system level driver (ie, a Windows printer
> entry) that might be preventing changes...
> 
> 
> 
> 
> 
> * Too many 3rd-party modules still aren't available in 2.5 versions
> for my tastes...
> --
> Wulfraed  Dennis Lee Bieber   KD6MOG
> [EMAIL PROTECTED] [EMAIL PROTECTED]
> HTTP://wlfraed.home.netcom.com/
> (Bestiaria Support Staff: [EMAIL PROTECTED])
> HTTP://www.bestiaria.com/


My fault,

I actually _had_ the issue with python 2.4

I removed everything and reinstalled python 2.4.4, pywin( lastest) and
pyserial (latest) ... the problem is gone.

hg



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pyserial example program error: win32file.SetupComm reports 'Incorrect function.'

2007-04-07 Thread hg
Ron Jackson wrote:

> Dennis Lee Bieber wrote:
>> On Wed, 07 Feb 2007 11:14:39 -0800, Ron Jackson
>> <[EMAIL PROTECTED]> declaimed the following in
>> comp.lang.python:
>> 
>> 
>>>I am using Python 2.5 on Windows XP. I have installed Pyserial and
>>>win32all extensions.
>>>
>> 
>> 2.4 on XP Pro SP2...
>> 
>> 
>>>When I try to run the example program scan.py (included below), or any
>>>other program using pyserial, as soon as it hits the statement:
>>>
>>>s = serial.Serial(i)
>>>
>> 
>> 
>>>>>import serial
>>>>>for i in range(256):
>> 
>> ...  try:
>> ...  print i,
>> ...  s = serial.Serial(i)
>> ...  print s.portstr
>> ...  s.close()
>> ...  except serial.SerialException:
>> ...  print
>> ...
>> 0 COM1
>> 1
>> 2 COM3
>> 3
>> 4
>> 5
>> 6
>> 7
>> 8
>> 9
>> 10
>> 11
>> and on and on...
>> 
>> 
>>>What do I need to do to fix this? Thanks for the help!
>> 
>> 
>> Does the serial port module require a compile for use with 2.5?
>> Well, with only one download since Python 2.2, guess not...
>> 
>> Something glitched in win32? Sorry, I don't know... However, since
>> those are Python source files, you could always plug in some debugging
>> lines around that win32 call to see what actually is there. Do you have
>> any unnatural serial ports on the machine? (Like a USB<>serial
>> converter?)
> 
> Trying your program, I get the same error 'Incorrect function.':
> 
> Traceback (most recent call last):
>File "", line 4, in 
>  s = serial.Serial(i)
>File "C:\Python25\Lib\site-packages\serial\serialutil.py", line 156, in
>__init__
>  self.open()
>File "C:\Python25\lib\site-packages\serial\serialwin32.py", line 57, in
>open
>  win32file.SetupComm(self.hComPort, 4096, 4096)
> error: (1, 'SetupComm', 'Incorrect function.')
> 
> 
> I tried PySerial on a laptop, also running XP Home SP2, and both the
> example program and the program you suggested work fine on the laptop.
> 
> The desktop computer that is giving me the error doesn't have any
> unnatural serial ports on it currently. The laptop worked fine, either
> with a USB device emulating COMM6 present or with the USB device
> disconnected.
> 
> I checked and both machines are running the same version of win32file,
> which is site-packages\win32\win32file.pyd, 88 KB dated 9/22/2006.
> 
> So my question is:
> 
> Why would the statement win32file.SetupComm(self.hComPort, 4096, 4096)
> 
> work just fine on one machine and not the other?
> 
> win32file.pyd can't be opened like a .py file, and I don't know what the
> rather cryptic error 'Incorrect function.' is trying to tell me. Does
> anyone who is familiar with win32file have an idea what the problem is?
> 
> Thanks for the help!
> 
>-- Ron


I am now facing your problem ... on a machine that used to work fine.

Have you figured it out ?

Could it be a conflict between pyserial and pywin32 ?

hg


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem with global variables

2007-04-02 Thread hg
Ed Jensen wrote:

> #! /usr/bin/env python
> 
> def tiny():
> bar = []
> for tmp in foo:
> bar.append(tmp)
> foo = bar
> 
> if __name__ == "__main__":
> foo = ['hello', 'world']
> tiny()


Like this ?

#! /usr/bin/env python

def tiny():
    bar = []
gobal foo
    for tmp in foo:
        bar.append(tmp)
    foo = bar

if __name__ == "__main__":
    foo = ['hello', 'world']
    tiny()


hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wxPython help

2007-03-31 Thread hg
Blh ([EMAIL PROTECTED]) wrote:

> i have installed wxpython v2.6 for python 2.4
> my python installation is at d:\python24
> 
> the statement "import wx" works perfectly
> but when i use "import images", it says that there is no module, but
> i know for a fact that there is.
> 
> can anyone help?
> 
> 
> --
> - --- -- -
> Posted with NewsLeecher v3.8 Beta 8
> Web @ http://www.newsleecher.com/?usenet
> --- -  -- -

Maybe this:

http://mail.python.org/pipermail/python-list/2002-February/128104.html

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Islam, the Religion of Ease

2007-03-30 Thread hg
Just came to me ... if wars were always fought with fish as weapons, they'd
be much less hunger in the world ... lol ... (as a non-anglo-saxon, I
thought for many years that lol meant "Lord, Oh Lord !)

hg (Holly Grail)


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Islam, the Religion of Ease

2007-03-30 Thread hg
[EMAIL PROTECTED] wrote:

> On Mar 29, 11:36 am, "moslim" <[EMAIL PROTECTED]> wrote:
>> Excuse me!!
>> Would you stop for a moment?!
>> O...man...Haven't you thought-one day- about yourself ?
>> Who has made it?
>> Have you seen a design which hasn't a designer ?!
>> Have you seen a wonderful,delicate work without a worker ?!
>> It's you and the whole universe!..
>> Who has made them all ?!!
>> You know who ?.. It's "ALLAH",prise be to him.
>> Just think for a moment.
>> How are you going to be after death ?!
>> Can you believe that this exact system of the universe and all of
>> these great creation will end in in nothing...just after death!
>> Have you thought, for a second, How to save your soul from Allah's
>> punishment?!
>> Haven't you thought about what is the right religion?!
>> Read ... and think deeply before you answer..
>> It is religion of Islam.
>> It is the religion that Mohammad-peace upon him- the last prophet, had
>> been sent by.
>> It is the religion that the right Bible- which is not distorted-has
>> preached.
>> Just have a look at The Bible of (Bernaba).
>> Don't be emstional.
>> Be rational and judge..
>> Just look..listen...compare..and then judge and say your word.
>> We advise you visiting
>> :http://www.islam-guide.comhttp://www.thetruereligion.orghttp://www.beconvinced.comhttp://www.plaintruth.orghttp://english.islamway.comhttp://www.todayislam.comhttp://www.prophetmuhammed.orghttp://www.islamtoday.net/english/http://www.islamunveiled.orghttp://www.islamic-knowledge.com
>>
>> We willingly recive any inquries at the e-mail :
>>
>> [EMAIL PROTECTED]
> 
> Respectofully:
> 
> 1.- Use the right place for your propaganda.
> 2.- Stop with religions, and militarism 
> 3.- Free the World of religious and Militars and you will get the
> Peace for everybody  
> 4.- Use your time for usefull matters
> 
> Regards
> 
> Adrian



I don't know ... maybe 'M' python can bring _real_ facts to the
discussion ... guiddo would not mind I gather

http://video.google.com/videoplay?docid=-2002541459944162494
http://www.youtube.com/watch?v=xrShK-NVMIU
http://www.mtholyoke.edu/~ebarnes/python/python.htm

I swore (holly s ) I'd never follow up on any of those guys ... but then
again, one can never trust an atheist.

hg











-- 
http://mail.python.org/mailman/listinfo/python-list


Re: very strange syntax errors

2007-03-28 Thread hg
Facundo Batista wrote:

> hg wrote:
> 
> 
>> I'v been facing some very strange errors lately:
>>
>> one example:
> 
> You'll need to paste here the exact code and the traceback.
> 
> Regards,
> 
> --
> .   Facundo
> .
> Blog: http://www.taniquetil.com.ar/plog/
> PyAr: http://www.python.org/ar/

Hi,

the code is _very_ long and has many dependencies (the longest file has a
few thousand lines (GUI callbacks) ... I know, need to refactor / but my
client is in a hurry right now so that'll wait )

So I'm not sure how I can provide any source that'll help .

I'll try the untab function of pydev on all files and see whether that fixes
the problems

hg



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: very strange syntax errors

2007-03-28 Thread hg
hg wrote:

> Hi,
> 
> I'v been facing some very strange errors lately:
> 
> one example:
> 
> def __init__(self):
> 
> import my_info
> some_text = my_info.T_SOME_TEXT
>   ^ syntax error
> 
> 
> I manage to get rid of that one by moving the import on top of my file.
> 
> Note: Python 2.4.1 under Windows
> 
> 
> Any clue ?
> 
> Thanks,
> 
> hg


PS:

and I also get some even weirder studd such as an error on line 374 when I
add a print on line 65

I'm using pydev + pydev ext

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


very strange syntax errors

2007-03-28 Thread hg
Hi,

I'v been facing some very strange errors lately:

one example:

def __init__(self):

import my_info
some_text = my_info.T_SOME_TEXT
  ^ syntax error


I manage to get rid of that one by moving the import on top of my file.

Note: Python 2.4.1 under Windows


Any clue ?

Thanks,

hg


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: socket read timeout

2007-03-28 Thread hg
[EMAIL PROTECTED] wrote:

> 
> hg> My issue with that is the effect on write: I only want a timeout
>     on
> hg> read ...  but anyway ...
> 
> So set a long timeout when you want to write and short timeout when you
> want to read.
> 
> Skip


Not bad  .. thanks

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: socket read timeout

2007-03-27 Thread hg
Facundo Batista wrote:

> hg wrote:
> 
>> Do you mean use select ?
> 
> No, socket's timeout:
> 
>>>> import socket
>>>> s = socket.socket()
>>>> s.settimeout(5)
>>>> ...
> 
> Regards,
> 
> --
> .   Facundo
> .
> Blog: http://www.taniquetil.com.ar/plog/
> PyAr: http://www.python.org/ar/


My issue with that is the effect on write: I only want a timeout on read ...
but anyway ...

Thanks,

hg


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: socket read timeout

2007-03-27 Thread hg
Steve Holden wrote:

> Jarek Zgoda wrote:
>> hg napisa?(a):
>> 
>>> I am looking for the most efficient / cleanest way to implement a socket
>>> read with timeout (Windows mainly but would be great if the same code
>>> worked under *nix)
>> 
>> Did you see http://www.timo-tasi.org/python/timeoutsocket.py ?
>> 
> Note that since 2.4, I believe, sockets in the standard library allow
> you to specify a timeout parameter.
> 
> regards
>   Steve
> --
> Steve Holden   +44 150 684 7255  +1 800 494 3119
> Holden Web LLC/Ltd  http://www.holdenweb.com
> Skype: holdenweb http://del.icio.us/steve.holden
> Recent Ramblings   http://holdenweb.blogspot.com

Hi and thanks to all.

Do you mean use select ?

Thanks,

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


socket read timeout

2007-03-27 Thread hg
Hi,

I am looking for the most efficient / cleanest way to implement a socket
read with timeout (Windows mainly but would be great if the same code
worked under *nix)

Tanks,

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: logging and wx.Timer

2007-03-15 Thread hg
hg wrote:

> Jordan wrote:
> 
>> On Mar 14, 1:52 am, hg <[EMAIL PROTECTED]> wrote:
>>> Hi,
>>>
>>> I read that logging was thread safe ... but can I use it under a GUI
>>> timer ?
>>>
>>> Thanks,
>>>
>>> hg
>> 
>> That was barely enough information to be worthy of a reply.  Need more
>> than that.  What do you mean under a gui timer? What gui? What type of
>> usage? More info = more (and better) help.  Cheers.
>> 
>> JT
> 
> Twas in the title: wx.timer
> 
> REgards,
> 
> hg


FYI, the answer from the wxPython NG is yes ... it should work fine

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: looking for a simple crypto library

2007-03-15 Thread hg
Paul Rubin wrote:

> tlslite

cool !

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: looking for a simple crypto library

2007-03-15 Thread hg
P?nar Yanarda? wrote:

>  Hi all,
> 
> I'm looking for a crypto library which can simply:
> 
> - extracts a public key from a (X.509) certificate,
> 
> - supports public-key algorithms.
> 
> Any suggestions?
> 
> With love,
> --
> P?nar "PINguAR" Yanarda?
> http://pinguar.org
pyopenssl ?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: logging and wx.Timer

2007-03-14 Thread hg
Jordan wrote:

> On Mar 14, 1:52 am, hg <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> I read that logging was thread safe ... but can I use it under a GUI
>> timer ?
>>
>> Thanks,
>>
>> hg
> 
> That was barely enough information to be worthy of a reply.  Need more
> than that.  What do you mean under a gui timer? What gui? What type of
> usage? More info = more (and better) help.  Cheers.
> 
> JT

Twas in the title: wx.timer

REgards,

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


logging and wx.Timer

2007-03-14 Thread hg
Hi,

I read that logging was thread safe ... but can I use it under a GUI timer ?

Thanks,

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem I have with a while loop/boolean/or

2007-03-13 Thread hg
hg wrote:

> [EMAIL PROTECTED] wrote:
> 
>> Hi all.
>> 
>> I have a problem with some code :(
>> 
>> ---
>> 
>> hint = raw_input("\nAre you stuck? y/n: ")
>> hint = hint.lower()
>> 
>> while (hint != 'n') or (hint != 'y'):
>> hint = raw_input("Please specify a valid choice: ")
>> 
>> -
>> 
>> so everytime I run the program, and enter my choice as y or n, I'm
>> told to 'Please Specify a valid Choice Again' and can't get out of the
>> loop.
>> 
>> 
>> 
>> ---
>> 
>> hint = raw_input("\nAre you stuck? y/n: ")
>> hint = hint.lower()
>> 
>> while (hint != 'n'):
>> hint = raw_input("Please specify a valid choice: ")
>> 
>> -
>> 
>> As for here when I enter n, I can leave the while loop.
>> 
>> Anyway I can't put my finger on this, so I'd be real grateful if
>> someone could tell me what I've done wrong. Thanks.
>> (I have a guy feeling it's something really silly I'm overlooking...)
> 
> Hi,
> 
> Whatever hint is:
> (hint != 'n') or (hint != 'y')
> is always going to be true
> 
> as it cannot really be both at the same time
> 
> use "and" instead of "or"
> 
> hg


oops, meant to answer to the main post

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem I have with a while loop/boolean/or

2007-03-13 Thread hg
[EMAIL PROTECTED] wrote:

> Hi all.
> 
> I have a problem with some code :(
> 
> ---
> 
> hint = raw_input("\nAre you stuck? y/n: ")
> hint = hint.lower()
> 
> while (hint != 'n') or (hint != 'y'):
> hint = raw_input("Please specify a valid choice: ")
> 
> -
> 
> so everytime I run the program, and enter my choice as y or n, I'm
> told to 'Please Specify a valid Choice Again' and can't get out of the
> loop.
> 
> 
> 
> ---
> 
> hint = raw_input("\nAre you stuck? y/n: ")
> hint = hint.lower()
> 
> while (hint != 'n'):
> hint = raw_input("Please specify a valid choice: ")
> 
> -
> 
> As for here when I enter n, I can leave the while loop.
> 
> Anyway I can't put my finger on this, so I'd be real grateful if
> someone could tell me what I've done wrong. Thanks.
> (I have a guy feeling it's something really silly I'm overlooking...)

Hi,

Whatever hint is:
(hint != 'n') or (hint != 'y')
is always going to be true

as it cannot really be both at the same time 

use "and" instead of "or"

hg






-- 
http://mail.python.org/mailman/listinfo/python-list


Re: unsigned integer?

2007-03-10 Thread hg
Dan Bishop wrote:

> On Mar 10, 11:32 am, "Jack" <[EMAIL PROTECTED]> wrote:
>> This is a naive question:
>>
>> "%u" % -3
>>
>> I expect it to print 3. But it still print -3.
>>
>> Also, if I have an int, I can convert it to unsigned int in C:
>>int i = -3;
>>int ui = (unsigned int)i;
>>
>> Is there a way to do this in Python?
> 
> def unsigned(n):
> return n & 0x


or abs(-1) ?


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: C++ and Python

2007-03-09 Thread hg
Gabriel Genellina wrote:

> En Fri, 09 Mar 2007 05:28:54 -0300, hg <[EMAIL PROTECTED]> escribió:
> 
>> Mandus wrote:
>>> 8 Mar 2007 22:04:48 -0800 skrev [EMAIL PROTECTED]:
>>>> I'm considering about generating some Python Bindings for C++
>>>> libraries. What are considered the best tools for doing something like
>>>> this? I know that there are SWIG, SIP, Boost.Python, and GCC_XML.
>>>
>>> We are doing this quite extensively at work, and have found that in the
>>> long run SWIG is the best solution. OMMV, but if you ask me, the answer
>>> is SWIG.
>>
>> Why do you think it is better than ctypes ?
> 
> I won't say SWIG is better than anything, but how would you use ctypes to
> create an instance of a class with several levels of inheritance, and then
> invoke a virtual method?
> You have to mangle all the names (not too bad, can be done in Python
> following the rules) but you also need to find the right function pointer
> in the virtual method table; and that can't be done without processing the
> source code (at least the .h) in order to know the layout and ordering of
> the methods.
> Let alone inline functions, templates and #define macros.
> 
> --
> Gabriel Genellina


I'm not very familiar with the technology as I just have had to modify an
extension here and there.

I guess my question is off topic as a C++ dll / shared lib is not my main
target but rather C: I need to integrate a printer driver and and would
like if possible to avoid all of the .h stuff involved with SWIG (I am not
being sarcastic): if I can setup my prototypes directly in python, why go
through an extra layer ?

Aren't ctypes better suited to such an application ?

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: floating point rounding

2007-03-09 Thread hg
John Henry wrote:

> On Mar 9, 5:45 am, hg <[EMAIL PROTECTED]> wrote:
>> hg wrote:
>> > Hi,
>>
>> > Here is my issue:
>>
>> > f = 1.5 * 0.01
>> > f
>> >>> 0.014999
>> > '%f' % f
>> >>>'0.015000'
>>
>> > But I really want to get 0.02 as a result ... is there a way out ?
>>
>> > Thanks,
>>
>> > hg
>>
>> round
> 
> 
> Or more precisely:
> 
> round(0.014999,2)
> 
> if that's what you wish to do.
Indeed.

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: floating point rounding

2007-03-09 Thread hg
hg wrote:

> Hi,
> 
> Here is my issue:
> 
> f = 1.5 * 0.01
> f
>>> 0.014999
> '%f' % f
>>>'0.015000'
> 
> 
> But I really want to get 0.02 as a result ... is there a way out ?
> 
> Thanks,
> 
> hg

round

-- 
http://mail.python.org/mailman/listinfo/python-list


floating point rounding

2007-03-09 Thread hg
Hi,

Here is my issue:

f = 1.5 * 0.01
f
>> 0.014999
'%f' % f
>>'0.015000'


But I really want to get 0.02 as a result ... is there a way out ?

Thanks,

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: C++ and Python

2007-03-09 Thread hg
Mandus wrote:

> 8 Mar 2007 22:04:48 -0800 skrev [EMAIL PROTECTED]:
>> Hi Everyone,
>>
>> I'm considering about generating some Python Bindings for C++
>> libraries. What are considered the best tools for doing something like
>> this? I know that there are SWIG, SIP, Boost.Python, and GCC_XML.
> 
> We are doing this quite extensively at work, and have found that in the
> long run SWIG is the best solution. OMMV, but if you ask me, the answer
> is SWIG.
> 
> mvh,
> --
> Mandus - the only mandus around.

Hi,

Why do you think it is better than ctypes ?

Thanks,

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a technic to avoid this bug

2007-02-27 Thread hg
Michele Simionato wrote:

> pychecker

Thanks all ... pydev extension does not however ... will have to install
pychecker also.

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Is there a technic to avoid this bug

2007-02-27 Thread hg
Hi,

In C/C++ I got used to  write an expression like so:

#define TEST 0

if (TEST == value) 
{

}

in order to avoid the usual bug:
if (value = TEST)
{

}

In a relatively similar domain, I spent a few hours find this bug:

value == self.Get_Value()
if value == WHATEVER:
   do this

instead of
value = self.Get_Value()
if value == WHATEVER:
   do this

Is there a way to avoid such a bug with some type of construct ?

Thanks,
hg


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python+Windows specific questions

2007-02-26 Thread hg
hg wrote:

> Hi,
> 
> Do I need the pywin32 extentions to:
> 
> 1) change the pc system date ?
> 2) launch a ppp connection   ?
> 
> Thanks,
> 
> hg

Yes to both I guess.

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Python+Windows specific questions

2007-02-26 Thread hg
Hi,

Do I need the pywin32 extentions to:

1) change the pc system date ?
2) launch a ppp connection   ?

Thanks,

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help on object scope?

2007-02-25 Thread hg
[EMAIL PROTECTED] wrote:

> Hello everybody,
> 
> I have a (hopefully) simple question about scoping in python. I have a
> program written as a package, with two files of interest. The two
> files are /p.py and /lib/q.py
> 
> My file p.py looks like this:
> 
> ---
> 
> from lib import q
> 
> def main():
>   global r
>   r = q.object1()
>   s = q.object2()
> 
> if __name__ == "__main__":
>   main()
> 
> ---
> 
> My file q.py in the subdirectory lib looks like this:
> 
> class object1:
>   t = 3
> 
> class object2:
>   print r.t
> 
> ---
> 
> Python gives me an error, saying it can't recognize global name r.
> However I define r as global in the top-level main definition! Can
> anyone suggest how I can get around this, if I want to define and bind
> global names inside of main() which are valid in all sub-modules?
> 
> Thanks very much for your help!

Might be wrong, but globals can only be global to the module they're
declared in.

I suggest you find another way such as passing your object as a parameter

hg


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What is the best queue implemetation in Python?

2007-02-22 Thread hg
hg wrote:

> f u

"f o" of course

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What is the best queue implemetation in Python?

2007-02-22 Thread hg
John Machin wrote:

> On Feb 23, 11:12 am, "John" <[EMAIL PROTECTED]> wrote:
>> I want to write a code for Breadth First Traveral for Graph, which needs
>> a queue to implement.
>>
>> I wonder that for such a powerful language as Python, whether there is a
>> better and simpler implementation for a traditional FIFO queue?
>>
> 
> Better and simpler than *WHAT*?

Sorry, but you do that all the time ... "ask the question as you know the
answer, otherwise shut the f u ..."

Can't you assume for a second that other people do not have your wonderful
brain and still have to make it through 60+ years of life of learning ?

hg


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to covert ASCII to integer in Python?

2007-02-22 Thread hg



Some people spend many buck bying guessing games ... be nice !

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to covert ASCII to integer in Python?

2007-02-22 Thread hg
John wrote:

> Is there any built in function that converts ASCII to integer or vice
> versa in Python?
> 
> Thanks!
>>> int('10')
10
>>> str(10)
'10'
>>> 

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PyDev on Mac

2007-02-18 Thread hg
Ahmer wrote:

> On Feb 18, 4:50 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
>> Ahmer schrieb:
>>
>> > I've been trying to set up PyDev on my new MacBook Pro, but i have not
>> > had an success.
>>
>> > Could you please help!
>>
>> Just wait until my crystal ball comes back from the cleaners, and I will
>> start looking at your problem.
>>
>> As you can lay back and do nothing while that happens, I suggest you
>> take this highly entertaining read:
>>
>> http://www.catb.org/~esr/faqs/smart-questions.html
>>
>> Diez
> 
> 
> The main problem seems to be locating Python.
> 
> Even though I installed the official python for mac, it says the
> interpreter is invalid.
> So I tried jPython, no succes on that either. It always tells me I am
> using an invlaid interpreter.

Are you pointing to the python directory in the eclipse/pydev config
dialog ?

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: f---ing typechecking

2007-02-14 Thread hg
> Its ugly and boring.

It's rude, unnecessary _and_ boring


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: float print formatting

2007-02-13 Thread hg
Grant Edwards wrote:

> On 2007-02-13, hg <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> Considering the float 0.0, I would like to print 00.00.
>>
>> I tried '%02.02f' % 0.0 ... but I get 0.00
> ^^
> That's the specifierfor how many total columns you want to use
> (including the decimal point and all digits to either side).
> 
>> Any clue ?
> 
>>>> "%05.02f" % 0.0
> '00.00'
> 
> --
> Grant Edwards   grante Yow!  Yow!! "Janitor
>   at   trapped in sewer uses
>   ESP
>visi.comto find decayed
>burger"!!

Thanks

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: float print formatting

2007-02-13 Thread hg
Neil Cerutti wrote:

> The eighth-graders will be presenting Shakespeare's Hamlet in the church
> basement on Friday at 7 p.m. The congregation is invited to attend this
> tragedy. --Church Bulletin Blooper

;-) I like that !

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: float print formatting

2007-02-13 Thread hg
Peter Otten wrote:

> hg wrote:
> 
>> Considering the float 0.0, I would like to print 00.00.
>> 
>> I tried '%02.02f' % 0.0 ... but I get 0.00
>> 
>> Any clue ?
> 
> The first integer specifies the total width:
> 
>>>> "%05.2f" % 0
> '00.00'
> 
> Peter

Many thanks !

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Mulig SPAM: float print formatting

2007-02-13 Thread hg
NOSPAM plz wrote:

> hg skrev:
>> Hi,
>>
>> Considering the float 0.0, I would like to print 00.00.
>>
>> I tried '%02.02f' % 0.0 ... but I get 0.00
>>
>> Any clue ?
>>
>> Thanks,
>>
>> hg
>>
>>   
> Try this:
> 
> a = 45.45 # the floating number
> 
> print "some text",
> print a,
> print "some text again"
> 
> or just this:
> 
> print "some text",
> print 45.45,
> print "some text again"
> 
> Hope it helped :D
> 
> Andreas

Sorry,

must be very slow or not enough coffee yet ... my purpose is to display a
justified report, so I format my floats into strings which I next draw in a
bitmap.

hg


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: float print formatting

2007-02-13 Thread hg
Neil Cerutti wrote:

> On 2007-02-13, hg <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> Considering the float 0.0, I would like to print 00.00.
>>
>> I tried '%02.02f' % 0.0 ... but I get 0.00
>>
>> Any clue ?
> 
> Yes. How wide (total) is "0.00", compared to "00.00"?
> 
> --
> Neil Cerutti

I do not get it


s = '%02.02f' % 0.0
s
>> '0.00'
len(s)
>> 4


-- 
http://mail.python.org/mailman/listinfo/python-list


float print formatting

2007-02-13 Thread hg
Hi,

Considering the float 0.0, I would like to print 00.00.

I tried '%02.02f' % 0.0 ... but I get 0.00

Any clue ?

Thanks,

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help please!!

2007-02-11 Thread hg
darren112 wrote:

> Hi Im new to python and I desperately need help with this task
> This is everything of what I need to do...
> 
> The program to be written in Python obviously..
> 
> The program should support brute-forcing of the authentication process
> for a Telnet server via a dictionary attack.
> 
> The python program is required to take four parameters: a) the IP
> address of a Computer, b) the port number that the Telnet server is
> running on the computer , c) the name of a file containing a list if
> usernames, and b) the name of a file containing a list of word/phrases
> to be used as passwords.
> 
> The program should then attempt to authenticate itself to the Telnet
> server via trying every password for every username. The program
> should report when it is successful.
> 
> Please help me And as I am new to all this please post step by
> step instructions...

That is funny !

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wxPython libraries never detected

2007-02-10 Thread hg
hg wrote:

> [EMAIL PROTECTED] wrote:
> 
>> On Feb 10, 1:07 pm, hg <[EMAIL PROTECTED]> wrote:
>>> By default, you need to have wx installed in the python site-package
>>> path / under Mandriva, I have wx 2.8 installed
>>> here:  /usr/lib/python2.4/site-packages/wx-2.8-gtk2-ansi/
>>>
>>> hg
>> 
>> Ah, now I see. But I have a new problem:
>> 
>> "ls /usr/lib/python2.4/site-packages | grep wx-2.8" returns "wx-2.8-
>> gtk2-unicode"
>> 
>> I copied wx-2.8-gtk2-unicode to /usr/lib/python2.5/site-packages/,
>> which I assume the programs I am attempting to compile and run are
>> using by default, but they still do not find the libraries. How can I
>> tell where the programs are searching for the libraries?
>> 
>> Thanks.
> 
> If you're going to try the copy technique (never tried it) , you also need
> to copy wx.pth and wxversion.py.
> 
> hg

Oh, and remember that a 2.4.pyc will not run with 2.5 ... so I would also
remove all .pyc that I might have copied.

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wxPython libraries never detected

2007-02-10 Thread hg
[EMAIL PROTECTED] wrote:

> On Feb 10, 1:07 pm, hg <[EMAIL PROTECTED]> wrote:
>> By default, you need to have wx installed in the python site-package path
>> / under Mandriva, I have wx 2.8 installed
>> here:  /usr/lib/python2.4/site-packages/wx-2.8-gtk2-ansi/
>>
>> hg
> 
> Ah, now I see. But I have a new problem:
> 
> "ls /usr/lib/python2.4/site-packages | grep wx-2.8" returns "wx-2.8-
> gtk2-unicode"
> 
> I copied wx-2.8-gtk2-unicode to /usr/lib/python2.5/site-packages/,
> which I assume the programs I am attempting to compile and run are
> using by default, but they still do not find the libraries. How can I
> tell where the programs are searching for the libraries?
> 
> Thanks.

If you're going to try the copy technique (never tried it) , you also need
to copy wx.pth and wxversion.py.

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wxPython libraries never detected

2007-02-10 Thread hg
[EMAIL PROTECTED] wrote:

> Hi, I recently started coding with Python and I've been trying for the
> past hour or so to determine why, every time I "import wx" (or compile
> another piece of code that imports wx), Python can never find the
> libraries.
> 
> I'm running Ubuntu Edgy 6.10, and, as per
> http://www.wxpython.org/download.php#sources, updated sources.list with
> the sources and installed python-wxgtk2.8, python-wxtools and wx2.8-i18n.
> I compiled the latest Python (as of writing), 2.5, from source.
> 
> For example, SPE tells me that I "need to install at least wxPython v.
> 2.5.4.1 to run SPE" and any code that relies on "import wx" reports
> "ImportError: No module named wx". However, "whereis wx" on the
> command line reports "wx: /usr/lib/wx /usr/local/lib/wx /usr/include/
> wx". What could be wrong here? I can't figure out why wx isn't being
> detected.
> 
> Many thanks.

By default, you need to have wx installed in the python site-package path /
under Mandriva, I have wx 2.8 installed
here:  /usr/lib/python2.4/site-packages/wx-2.8-gtk2-ansi/


hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Hacking in python

2007-02-10 Thread hg
Calvin Spealman wrote:

> http://en.wikipedia.org/wiki/Hacker_%28disambiguation%29
> 
> Educate yourself on what hacking actually is. We're all hackers,
> because it just means we get the most out of code, enjoy pushing our
> technology to the limit, and generally love programming. The term has
> been abused by the media and you don't do much more than show your own
> naiveness by asking such a question. You also do a great job of
> insulting everyone on this list.
> 
> On 2/10/07, enes naci <[EMAIL PROTECTED]> wrote:
>>
>> i would like to know about hacking in python too whether its illegal
>> or not is not the point and anyway it doesn't mean i'm gong to use it.
>>
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>
> 
> 
> --
> Read my blog! I depend on your acceptance of my opinion! I am interesting!
> http://ironfroggy-code.blogspot.com/


So that was that weird feeling I felt ... insulted

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Can somebody give me a python code for this?

2007-02-07 Thread hg
John wrote:

> Given an array of elements, look at it as a binary tree. Start at the last
> interior node, and downheap it. Then downheap the previous interior node,
> and continue in this fashion, up to the root.

Your teacher ?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python compiled on Windows

2007-02-05 Thread hg
Duncan Booth wrote:

> Franz Steinhaeusler <[EMAIL PROTECTED]> wrote:
> 
>> Hello, I'm only curious.
>> 
>> Why is Python and most extension (also wxPython) not built using an
>> open source compiler like gcc or g++ on Windows?
>> 
>> I'm always wondering, why Microsoft is still supported
>> in that way, using VC++ 7.1, if I'm not wrong.
>> 
>> Ok, maybe the compiled assembler code could be better, but
>> this cannot be the reason, or?
>> 
>> It would be wonderful (from the principle) if this could be possible.
>> From the standpoint of open source.
>> 
>> What are your opinions?
> 
> Practicality beats purity.
> 
> To maximise the interoperability of Python with other software on the
> platform it makes sense to use the best supported compiler environment for
> the platform.

Still, if one considers the many threads of people trying to get it to work
with the "free" version + other people that had to invest in VS mostly for
that (I did) / it might eventually be fair to reconsider.

+ a dll is a dll 

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Will Python Run On Microsoft Vista?

2007-02-05 Thread hg
slogging_away wrote:

> I know, I know - flame away but its not clear to me if Python will run
> on a system running Microsoft Vista.  Is anyone successfully running
> Python on Vista?  If so, is it what version of Python are you
> running?  I'm ordering a new system and if Python won't work on Vista
> then it will definately influence the OS selection.
> 
> Thanks in advance!
OK so it does not ;-) !


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Calling J from Python

2007-02-05 Thread hg
Bjoern Schliessmann wrote:

> Gosi wrote:
> 
>> J is in many ways similar to Python.
> 
> The only one I see at the moment is that they're both some kind of
> programming languages.
> 
>> J has very many advanced operations.
> 
> Sure.
> 
> Mh, just looking at some "advanced" J source taken from
> wikipedia.org makes me feel sick:
> 
> | Here's a J program to calculate the average of a list of numbers:
> |avg=: +/ % #
> |avg 1 2 3 4
> | 2.5
> 
> In the meantime, do you now have an answer to why we should care?
> 
> Regards,
> 
> 
> Björn
> 
> --
> BOFH excuse #314:
> 
> You need to upgrade your VESA local bus to a MasterCard local bus.


Be nice !

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Subscribing" to topics?

2007-02-04 Thread hg
Mizipzor wrote:

> Is there a way to "subscribe" to individual topics? im currently
> getting bombarded with daily digests and i wish to only receive a mail
> when there is activity in a topic that interests me. Can this be done?
> 
> Thanks in advance.
Use a news reader and leave the mailing list

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Where Does One Begin?

2007-02-02 Thread hg
Mister Newbie wrote:

> I have no programming experience. I want to learn Python so I can make
> simple, 2D games. Where should I start? Can you recommend a good book?
> 
> Thank you.
http://www.diveintopython.org/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Convert raw data to XML

2007-01-30 Thread hg
[EMAIL PROTECTED] wrote:

> On Jan 30, 12:05 pm, John Nagle <[EMAIL PROTECTED]> wrote:
>> [EMAIL PROTECTED] wrote:
>> > On Jan 29, 8:54 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote:
>>
>> >>En Mon, 29 Jan 2007 23:42:07 -0300, <[EMAIL PROTECTED]> escribió:
>> > the reason I wanted to write it as a file was to parse the file, look
>> > for a specific attribute and execute a set of commands based on the
>> > value of the attribute.. also i needed to display the output of the
>> > http post in a more readable format..
>>
>> That's straightforward.  You confused people by asking the
>> wrong question.  You wrote "Convert raw data to XML", but what
>> you want to do is parse XML and extract data from it.
>>
>> This will do what you want:
>>
>>http://www.crummy.com/software/BeautifulSoup/
>>
>> For starters, try
>>
>> from BeautifulSoup import BeautifulStoneSoup
>> xmlstring = somexml ## get your XML into here as one big
>> string
>> soup = BeautifulStoneSoup(xmlstring)# parse XML into tree
>> print soup.prettify()   # print out in indented format
>>
>> "soup" is a tree structure representing the XML, and there are
>> functions to easily find items in the tree by tag name, attribute,
>> and such.  Work on the tree, not a file with the text of the indented
>> output.
>>
>> John Nagle
> 
> is there any other way to do this without using BeautifulStoneSoup..
> using existing minidom or ext..
> i dont want to install anything new
yes, write it ;-)




-- 
http://mail.python.org/mailman/listinfo/python-list


looking for ppp dialing tutorial / resources

2007-01-27 Thread hg
Hi,

I need to implement ppp client connection in my program ... found chestnut
dialer so far ...

any other resource in mind ?

Thanks

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Right-Justifying Numeric Output

2007-01-25 Thread hg
Rich Shepard wrote:

>I have this print statement in a function:
> 
> print '%2d   $%11.2f  $%10.2f  $%9.2f  $%9.2f' %(nper, pv, diff, ten,
> bonus)
> 
> and I would like to have the output right justified in the specified
> field. My trials using .rjust(n) have produced that string in the output,
> not the intended results. Is there a way of right justifying numeric
> output?
> 
> Thanks,
> 
> Rich
> 
> --
> Richard B. Shepard, Ph.D.   |The Environmental Permitting
> Applied Ecosystem Services, Inc.|  Accelerator(TM)
> <http://www.appl-ecosys.com> Voice: 503-667-4517  Fax:
> 503-667-8863

assuming max size = 10

#with spaces 
>> '% 10d' % 11
'11'
#with zeros
>>'%010d' % 11
'11'

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python does not play well with others

2007-01-24 Thread hg
egbert wrote:

> On Wed, Jan 24, 2007 at 06:24:37AM +, Harry George wrote:
>> 
>> Perl - excellent modules and bindings for just about everything ...
>> Java - a world of its own.  They reinvent the wheel instead of ...
>> PHP - are we talking web scripts or serious programs?  Are you ...
>> C - the portable assembler.  Solid, trusted, tunable ...
>> C++ - objects tacked onto C; but that didn't work so invent ...
>> Python - it just works.  Same scripts run on every platform ...
> 
> What about C# ?
> e
> --
> Egbert Bouwman - Keizersgracht 197 II - 1016 DS  Amsterdam - 020 6257991
> 


arf arf

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: My python programs need a GUI, wxPython or PyQt4?

2007-01-24 Thread hg
Kevin Walzer wrote:

> Kevin Walzer wrote:
> 
>> 
>> Tablelist: http://www.nemethi.de/
>> Tabelist for Tkinter (with Tile support):
>> http://tkinter.unpythonic.net/wiki/TableListTileWrapper
>> 
> 
> Additionally, here is a link to some screenshots for Tablelist:
> 
> http://www.nemethi.privat.t-online.de/tablelist/screenshots.html
> 
> 
> --
> Kevin Walzer
> Code by Kevin
> http://www.codebykevin.com

Just for info - one of the reasons I stopped using Tkinter a few years ago
was for the lack of print support (preview ...) - is there such an
extension today ?

hg

-- 
http://mail.python.org/mailman/listinfo/python-list


  1   2   3   >