Re: Idle

2005-10-04 Thread Philippe C. Martin
Hi,

I remember having that when the wrong version of TCL/TK was installed on my
system.

Regards,

Philippe



Hrvoje Blazevic wrote:

> How do I get Idle to work on Linux?
> 
> I've tried to compile 2.4.2 on Fedora core 4, and Suse 9.3, but Idle is
> after make install either missing (Fedora), or reports **Idle can't
> import Tkinter... **
> 
> Thanks
> 
> -- Hrvoje

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


Re: how to capture key pressing

2005-10-10 Thread Philippe C. Martin
Hi,

Look at curses.

Philippe


billie wrote:

> Hi all. I'm searching for a module that permit me to costantly log every
> key pressed on the keyboard and eventually assign it a function (e.g. when
> "esc" is pressed: exit program").

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


A Logging System for Python

2005-10-17 Thread Philippe C. Martin
Dear all,

I have been looking for a logging system and have come across
http://www.red-dove.com/python_logging.html.

As the site refers to PEP 282, I assume this package is a potential
contender for integration in the Python distribution.

Am I correct and if so is there any trend to include it in Python 2.5 ?

Regards,

Philippe

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


Re: A Logging System for Python

2005-10-17 Thread Philippe C. Martin
Even better !

Thanks,

Philippe


Robert Kern wrote:

> Philippe C. Martin wrote:
>> Dear all,
>> 
>> I have been looking for a logging system and have come across
>> http://www.red-dove.com/python_logging.html.
>> 
>> As the site refers to PEP 282, I assume this package is a potential
>> contender for integration in the Python distribution.
>> 
>> Am I correct and if so is there any trend to include it in Python 2.5 ?
> 
> http://docs.python.org/lib/module-logging.html
> 

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


Re: wxPython + pyPlot

2005-10-18 Thread Philippe C. Martin
I think wxWidget comes with a sample

Philippe

Robert wrote:

> Maebe, does anyone have some examples with wxPython and pyplot?
> 
> Thanks again,
> Robert

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


Re: Vim capable IDE?

2005-10-18 Thread Philippe C. Martin
True and I had to give up emacs when I went to eclipse, but it was well
worth it.

I seem to recall that sourcenavigator allowed to configure an external
editor (or maybe was it sniff+ ?)

Regards,
Philippe



Chris Lasher wrote:

> Thanks for your responses, guys. I can't get the PIDA page to come up
> for me; server timeout error. I'll have to look into Eclipse more, but
> I've been warned that it's resource greedy and that the VI plugin
> doesn't provide very much functionality. Still, that's hearsay, so I'll
> have to find out for myself.
> 
> I would have figured Vim or VI editing behavior would be a lot more
> prevalent in IDEs but it seems to be quite rare. I don't understand
> that, because a lot of people seem to use IDEs, and a lot of people
> seem to use VI/Vim or Emacs. Is it the young guns that are tied to the
> IDEs, never knowing powerful text-editors exist, and old dogs sticking
> to their favorite editors, not giving in to all those "distracting"
> bells and whistles of IDEs? What's the deal? A marriage of the two
> would seem like the best of both worlds.
> 
> Chris

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


Re: wxPython + pyPlot

2005-10-18 Thread Philippe C. Martin
My mistake, I understood plot (as in "from wx.lib.plot import *" that comes
with wxwidgets and which does have a demo)

Sorry,

Philippe


Robert wrote:

> Philippe C. Martin wrote:
> 
>> I think wxWidget comes with a sample
>> 
>> Philippe
> Yes I use it, but there is not a sample with pyplot.
> 
> Robert

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


http/urlib pos/get question (newbie)

2005-10-20 Thread Philippe C. Martin
Hi,
(I am _very_ new to web programming)

I am writing a client module (browser plugin) and server module (Python CGI)
that need to exchange information.

I want the transaction to be intiated when the client accesses the link.

I need data  to go back and forth between the client and the server (cgi
script) with no impact on what the browser shows.

In the end (when I get the above to work), the server will say OK and the
actual page will appear or NOK and an ERROR page will appear.


I'm pretty clear (I think) as to what to do on the javascript (client) side
(XMLHttp) but am not certain if my cgi script must "urlib.open" its own
link in order to open the pipe on its side (there'll be some HTML GET/POST
tag I assume but where is the pipe/socket ?)

Thanks,

Philippe


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


Looking for client+server sample code (httplib and/or urlib)

2005-10-21 Thread Philippe C. Martin
Hi,

Are there such samples/tutorial out there ?

Regards,

Philippe


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


Re: http/urlib pos/get question (newbie)

2005-10-21 Thread Philippe C. Martin
I have found what I needed ... in one of my books :E)

regards,
Philippe


Philippe C. Martin wrote:

> Hi,
> (I am _very_ new to web programming)
> 
> I am writing a client module (browser plugin) and server module (Python
> CGI) that need to exchange information.
> 
> I want the transaction to be intiated when the client accesses the link.
> 
> I need data  to go back and forth between the client and the server (cgi
> script) with no impact on what the browser shows.
> 
> In the end (when I get the above to work), the server will say OK and the
> actual page will appear or NOK and an ERROR page will appear.
> 
> 
> I'm pretty clear (I think) as to what to do on the javascript (client)
> side (XMLHttp) but am not certain if my cgi script must "urlib.open" its
> own link in order to open the pipe on its side (there'll be some HTML
> GET/POST tag I assume but where is the pipe/socket ?)
> 
> Thanks,
> 
> Philippe

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


Re: Looking for client+server sample code (httplib and/or urlib)

2005-10-21 Thread Philippe C. Martin
I have found what I needed ... in one of my books :E)

Philippe


Philippe C. Martin wrote:

> Hi,
> 
> Are there such samples/tutorial out there ?
> 
> Regards,
> 
> Philippe

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


how to modify text in html form from python

2005-10-21 Thread Philippe C. Martin
Hi,

I am trying to change the data in a form field from python. The following
code does not crash but has no effect as if "form" is just a copy of the
original html form. 

Must I recreate the form order to do that ?

My point is for the client to be able to re-read the modified data.


Thanks,

Philippe
#!/usr/bin/python

import cgi
import os
import sys
import logging
import cgi
sys.stderr = sys.stdout
print "Content-type: text/html\n"
try:
form = cgi.FieldStorage()
#logging.warning (form)

except:
logging.exception("\nEXCEPTION 1")
try:

form['tosrv'].value = "TEST"
except:
logging.exception("\nEXCEPTION 2")
pass



Smart Logon
Smart Logon




  
 TO SERVER:
  
  
  FROM SERVER
  
   








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


Re: how to modify text in html form from python

2005-10-21 Thread Philippe C. Martin
PS: If my question is not clear, I am trying to "share" the form between the
client and server.

just as many sites out there allow you to modify existing data:
1) the server pops up a form with your data in it.
2) the client can modify it and submit.

I know this is a _basic_ question, sorry.

Philippe



Philippe C. Martin wrote:

> Hi,
> 
> I am trying to change the data in a form field from python. The following
> code does not crash but has no effect as if "form" is just a copy of the
> original html form.
> 
> Must I recreate the form order to do that ?
> 
> My point is for the client to be able to re-read the modified data.
> 
> 
> Thanks,
> 
> Philippe
> #!/usr/bin/python
> 
> import cgi
> import os
> import sys
> import logging
> import cgi
> sys.stderr = sys.stdout
> print "Content-type: text/html\n"
> try:
> form = cgi.FieldStorage()
> #logging.warning (form)
> 
> except:
> logging.exception("\nEXCEPTION 1")
> try:
> 
> form['tosrv'].value = "TEST"
> except:
> logging.exception("\nEXCEPTION 2")
> pass
> 
> 
> 
> Smart Logon
> Smart Logon
> 
> 
> 
> 
>   
>  TO SERVER:
>   
>   
>   FROM SERVER
>   
>   
> 
> 
> 
> 
> 
> 

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


Re: how to modify text in html form from python

2005-10-21 Thread Philippe C. Martin
Thanks Paul but I was not clear:

the html page is separate from the python script, it calls the python script
when the button is clicked.

The indentation error must be because of my cut and paste.

PS: My goal is to be able to exchange data between the server and the client
(browser plugin) as I have not yet found an easier way.

Regards,

Philippe




Paul McNett wrote:

> Philippe C. Martin wrote:
>> PS: If my question is not clear, I am trying to "share" the form between
>> the client and server.
>> 
>> just as many sites out there allow you to modify existing data:
>> 1) the server pops up a form with your data in it.
>> 2) the client can modify it and submit.
>> 
>> I know this is a _basic_ question, sorry.
> 
> When debugging Python cgi scripts, it is helpful to run the scripts from a
> command line just to make sure there aren't any compiler errors. Depending
> on how the server is set up, you'll get a server error or just a blank
> page if your script won't compile. When I run your script directly as I
> suggest, here's what I get:
> 
> [EMAIL PROTECTED]:~$ python test.py
>File "test.py", line 23
>  
>  ^
> SyntaxError: invalid syntax
> 
> D'oh! You needed to surround the html with quotes to make it a string, as
> in:
> 
> print """
> 
> ...
> 
> """
> 
> I don't really understand your original problem, but perhaps this will
> help get you rolling again.
> 
> 

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


Re: how to modify text in html form from python

2005-10-21 Thread Philippe C. Martin
Mike,

Here is what I am trying to do:

 WHAT 
-) a client opens his/her browser and click on some button which triggers my
plugin
-) the plugin starts to communicate with a server on some URL.
-) the communication between the server and the client involves a few
exchanges: data from client to server, then from server to client,.
-) just for info (I do not think it's relevant to my problem) on each side
(server and client) there is a smart card (that's why I need a plugin) and
the information exchanged comes from/go to the smart cards
-) The smart card on the server side eventually decides whether or not the
smart client on the client side is OK and tells so to the cgi script which
acts accordingly

* HOW (if there's a better way let me know please) **
As I have not found any better solution yet, I am trying to do the following
(on the server there is an html file and a cgi file)

-) the plugging opens the correct url which has a form with a "click" button
-) the customer clicks on the button
-) the server "puts" some information in a hidden form field (info from
local smart card)
-) the pluggin fetches the information from the form field and gives it to
its local smart card 
... (this a couple of time)
-) the cgi script gets the final verdict from the server smart card and acts
accordingly.

I hope that is clearer.

Regards,

Philippe





Mike Meyer wrote:

> "Philippe C. Martin" <[EMAIL PROTECTED]> writes:
> 
>> PS: If my question is not clear, I am trying to "share" the form between
>> the client and server.
> 
> Yes, your question is not clear. And this statement doesn't clarify
> it. That you quoted the "share" shows you are probably aware of this,
> if not consciously so.
> 
>> just as many sites out there allow you to modify existing data:
>> 1) the server pops up a form with your data in it.
>> 2) the client can modify it and submit.
> 
> This doesn't really help, either. The server can't "pop up" a form;
> only the client can do that. All the server can do is send data to
> the client.
> 
> The client can't modify data on the server. It can send data to the
> server, but that arrives as *new* data. The server can use that to
> replace old data, thus modifying that old data.
> 
>> I know this is a _basic_ question, sorry.
> 
> It's not clear it's a basic question, because it's not clear what
> you're trying to do.
> 
> Try answering these questions:
> 
> Where do you expect the HTML to come from?
> Where do you expect the data originally in the HTML form to come from?
> Where do you expect the data the user inputs into the form to be stored?
> 
>
> 
>> Philippe
>>
>>
>>
>> Philippe C. Martin wrote:
>>
>>> Hi,
>>> 
>>> I am trying to change the data in a form field from python. The
>>> following code does not crash but has no effect as if "form" is just a
>>> copy of the original html form.
>>> 
>>> Must I recreate the form order to do that ?
>>> 
>>> My point is for the client to be able to re-read the modified data.
>>> 
>>> 
>>> Thanks,
>>> 
>>> Philippe
>>> #!/usr/bin/python
>>> 
>>> import cgi
>>> import os
>>> import sys
>>> import logging
>>> import cgi
>>> sys.stderr = sys.stdout
>>> print "Content-type: text/html\n"
>>> try:
>>> form = cgi.FieldStorage()
>>> #logging.warning (form)
>>> 
>>> except:
>>> logging.exception("\nEXCEPTION 1")
>>> try:
>>> 
>>> form['tosrv'].value = "TEST"
>>> except:
>>> logging.exception("\nEXCEPTION 2")
>>> pass
>>> 
>>> 
>>> 
>>> Smart Logon
>>> Smart Logon
>>> 
>>> 
>>> 
>>> 
>>>   
>>>  TO SERVER:
>>>   
>>>   
>>>   FROM SERVER
>>>   
>>>   
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>
> 

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


Re: how to modify text in html form from python

2005-10-21 Thread Philippe C. Martin
Mike Meyer wrote:

> "Philippe C. Martin" <[EMAIL PROTECTED]> writes:
> 
>
> 
> Some. To continue clarifying:
> 
> The phrase "cgi script" refers to a server-side script that is run in
> response to the user clicking something on the client. That's what you
> expect it to be, right?
> 
Yes, the cgi script on the server side hooks up to the local (server) smart
card

> Do you expect the plugin to display a form? Or to ouput a form that
> the client will display?
No, I want of all the "html" stuff to be handled by the server

> 
> You've got lots of stuff going on here. I count at least five programs
> and three network connections. How much is working, and which parts
> are you trying to do in Python?

I am starting from existing applications (cross-platform - and in python
99% ) that work even through tcp-ip (sockets).

I am just trying to apply them to a web environement.

So prior to any user interaction with the page, I need some data exchange
between the plugin and the server (authentication).

So _if_ (I'm a web newbie) the server and the clien(plugin) could exchange
data through some form field, my prototype would be much further along.


Here is a small picture:
Smart Card <-> driver <-> cgi <-> apache .. [NET] browser <->
plugin <-> driver <-> Smart Card




Regards,

Philippe



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


Re: how to modify text in html form from python

2005-10-21 Thread Philippe C. Martin
I feel fairly stupid ... but to my defense in the past 17 years of coding,
i've only spent 3 days looking at web stuff:

I now can understand how "writing" to an existing form field from a cgi
script might not work: how would the browser know ?: unless there is a very
sophisticated scheme there (as those used in image transfer), I assume the
complete page would have to be sent back: so might as well
regenerate/rewrite everything.

Yes ?

I so, I'm back to finding a way for a browser plugin and a server based cgi
script to exchange information.

Any idea welcome... I know I don't want to open another socket/port but
stick to http:80


Regards,

Philippe







Mike Meyer wrote:

> "Philippe C. Martin" <[EMAIL PROTECTED]> writes:
> 
>> Mike,
>>
>> Here is what I am trying to do:
>>
>>  WHAT 
>> -) a client opens his/her browser and click on some button which triggers
>> my plugin
>> -) the plugin starts to communicate with a server on some URL.
>> -) the communication between the server and the client involves a few
>> exchanges: data from client to server, then from server to client,.
>> -) just for info (I do not think it's relevant to my problem) on each
>> side (server and client) there is a smart card (that's why I need a
>> plugin) and the information exchanged comes from/go to the smart cards
>> -) The smart card on the server side eventually decides whether or not
>> the smart client on the client side is OK and tells so to the cgi script
>> which acts accordingly
>>
>> * HOW (if there's a better way let me know please) **
>> As I have not found any better solution yet, I am trying to do the
>> following (on the server there is an html file and a cgi file)
>>
>> -) the plugging opens the correct url which has a form with a "click"
>> button -) the customer clicks on the button
>> -) the server "puts" some information in a hidden form field (info from
>> local smart card)
>> -) the pluggin fetches the information from the form field and gives it
>> to its local smart card
>> ... (this a couple of time)
>> -) the cgi script gets the final verdict from the server smart card and
>> acts accordingly.
>>
>> I hope that is clearer.
> 
> Some. To continue clarifying:
> 
> The phrase "cgi script" refers to a server-side script that is run in
> response to the user clicking something on the client. That's what you
> expect it to be, right?
> 
> Do you expect the plugin to display a form? Or to ouput a form that
> the client will display?
> 
> You've got lots of stuff going on here. I count at least five programs
> and three network connections. How much is working, and which parts
> are you trying to do in Python?
> 
> http://mail.python.org/mailman/listinfo/python-list


Re: how to modify text in html form from python

2005-10-21 Thread Philippe C. Martin
Paul,

That won't cut it: The cards I use/code do not have RSA capabilities but
only symmetrical algorithms (AES, 3DES, ). I use the same type of
authentication you would see between a POS and a Smart Card (ex: B0' in
France)

So I cannot hookup to one of the standards (PKCS11 or CSP).

Thanks anyway.

Regards,

Philippe



Paul Rubin wrote:

> "Philippe C. Martin" <[EMAIL PROTECTED]> writes:
>> * HOW (if there's a better way let me know please) **
>> As I have not found any better solution yet, I am trying to do the
>> following (on the server there is an html file and a cgi file)
> 
> If I understand it, you're trying to use a smart card to authenticate
> a web site login.  The major browsers already have smart card interfaces
> (Windows CAPI for MSIE, or PKCS11 for Netscape/Moz*) so you shouldn't
> need a plugin.  On the other hand, smart cards are very slow.
> 
> The typical approach is as follows (MSIE version).  Stop using special
> smart card programs and just use a card that implements CAPI with a
> from the vendor and that can sign against an X509 certificate.  The
> CSP will have a special signature that makes it less scary to install
> than a browser plugin.  You'll have to issue a cert for the smart card
> and there's various approaches to that, so I'll skip that part.  Set
> up a TLS server to require a client cert from the CA that signed the
> smart card.  The browser should recognize the challenge and select the
> right cert.  The CSP will have its own interface for the user entering
> a PIN along with inserting the card.  Once you have the TLS connection
> established, set a secure cookie in the client session and then redirect
> the browser to another URL that doesn't require the smart card (because
> otherwise the card will have to re-authenticate every click, which is
> very slow).  From then on, use the cookie for authentication (it can
> have a timeout or whatever).

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


Re: how to modify text in html form from python

2005-10-21 Thread Philippe C. Martin
Mike Meyer wrote:

> "Philippe C. Martin" <[EMAIL PROTECTED]> writes:
> 
>> I feel fairly stupid ... but to my defense in the past 17 years of
>> coding, i've only spent 3 days looking at web stuff:
>>
>> I now can understand how "writing" to an existing form field from a cgi
>> script might not work: how would the browser know ?: unless there is a
>> very sophisticated scheme there (as those used in image transfer), I
>> assume the complete page would have to be sent back: so might as well
>> regenerate/rewrite everything.
>>
>> Yes ?
>>
>> I so, I'm back to finding a way for a browser plugin and a server based
>> cgi script to exchange information.
>>
>> Any idea welcome... I know I don't want to open another socket/port but
>> stick to http:80
> 
> Then you're out of luck. You can't even depend on their being an open
> http connection available to use when the plugin runs. The browser may
> well do: Load all data. Close connections. Render page as far as we
> can. Launch code objects that we loaded.
> 
>  http://mail.python.org/mailman/listinfo/python-list


Re: how to modify text in html form from python

2005-10-21 Thread Philippe C. Martin
Mike Meyer wrote:

> 
> I don't know much about plugins.  I believe they get started when the
> page loads, which gives you a chance to do the authentication when you
> want it done.

Well not in this case actually: the user triggers the plugin which in turn
open the url, so the connection is "owned" by the plugin

> 
> That won't work very well. HTML goes to the client to display. The
> server can put data in hidden form elements that code running on the
> client side can get to - and change - via the document object model
> (DOM). However, the only way to send the changed data back to the
> server is to get the client to submit the form. You can automate that,
> but the results will be disconcerting to the user: they load a page,
> and it reloads multiple times as the plugin exchanges data with the
> server.
> 
Here again, I'm not dying for any page data to be visible: cannot the cgi
script and the plugin do their business before that ?

> 
> The problem with this is that the apache<->browser connection isn't
> "a" connection, it's a series of HTTP request/repsonse
> pairs. Originally, this implied tearing down and setting up a TCP
> connection for every request. Modern software will leave the link open
> and reuse it - but modern software also tends to have multiple
> connetions open, so it can fetch images and other embedded objects in
> parallel.
> 
I'm lost here, better do some more reading


> You can make this work, but doing it like that requires making
> multiple HTTP requests via the browser, which will be
> disconcerting. I'd recommend taking the browser out of the loop. Have
> the plugin talk directly to the server to do the
> authentication. That's what the latest web buzzword (AJAX) does:
> client-side software makes independent requests of the server (or
> *any* server) to get data, and possibly updates the document the
> browser is viewing as a result of that.
> 
Here I think it's OK as the plugin can "talk" to server prior to the browser
showing anything.


> So here's a scenario: the first cgi script gets info from the smart
> card that puts it in a hidden form element and sends the page to the
> browser. The plugin - started when the page loads - uses the DOM to
> get that data, then makes an *independent* HTTP request to the server,
> thus passing whatever it generated from the data in the form field to
> a second cgi script. This happens several times, then the plugin
> changes the HTML form to put whatever the cgi script generated into
> the form, so that when the user finally submits the form, the third
> cgi script - the one that handles the submitted form - sees the data
> from the second script.
> 
> Actually, the exchanges between the plugin and the server don't need
> to be HTTP requests. If you've got this working over some other TCP
> protocol, there's no reason you can't keep doing it that way.
> 
Maybe that's my clue: can a cgi script, once triggered by a (let's say) POST
request, use back and forth file transfer with the client ? through the
_existing_ connection.


> A word of warning: authentication protocols are fragile; they tend to
> stop being resistant to attacks after even relatively minor changes,
> so you want to be very carefull about changing the protocol. Web-based
> things are very open. You can't really do much to prevent the client
> end from doing *whatever they want* with the HTML you send them, or
> you generate for them on the fly. This also has serious security
> implications. Think carefully about what happens when the user pulls
> one of your forms out of the browser history, or bookmarks a
> page. Then make sure you get a thorough audit of the resulting
> system/protocol done by people who know what they're doing.
> 
Even if the data when seen, there would not be any security breach as the
cards have the keys + algo to understand the data. I realy just need of few
tens of bytes to go back and forth (I'm frustrated ;-)




Thanks

Philippe


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


Re: how to modify text in html form from python

2005-10-21 Thread Philippe C. Martin
Mike,

Again, thanks.

By plugin I mean the browsers' extensions: ex:
http://roachfiend.com/archives/2004/12/08/how-to-create-firefox-extensions/#more-4.
IE has the same type or resorts also to activeX components.

Right now I know how to program that guy to open a url

I guess I need to some thinking before I ask more questions.

Regards,

Philippe






Mike Meyer wrote:

> "Philippe C. Martin" <[EMAIL PROTECTED]> writes:
>> Mike Meyer wrote:
>>> I don't know much about plugins.  I believe they get started when the
>>> page loads, which gives you a chance to do the authentication when you
>>> want it done.
>> Well not in this case actually: the user triggers the plugin which in
>> turn open the url, so the connection is "owned" by the plugin
> 
> I think we don't mean the same thing when we say "plugin". To me, a
> plugin is a bit of code that gets executed when the page is rendered
> to provide custom content with it's own behavior. Flash is probably
> the most popular example. Like I said, I don't know much about
> plugins, so they may be usable in other ways.
> 
>>> That won't work very well. HTML goes to the client to display. The
>>> server can put data in hidden form elements that code running on the
>>> client side can get to - and change - via the document object model
>>> (DOM). However, the only way to send the changed data back to the
>>> server is to get the client to submit the form. You can automate that,
>>> but the results will be disconcerting to the user: they load a page,
>>> and it reloads multiple times as the plugin exchanges data with the
>>> server.
>> Here again, I'm not dying for any page data to be visible: cannot the cgi
>> script and the plugin do their business before that ?
> 
> Not if you're using plugin as defined above. Pretty much anything that
> happens on the browser end is triggered by things happening in HTML -
> which means it has to be displayed. I don't know of any way to
> download something to the browser to run without rendering *something*
> in the browser window - even if it's only a blank plage.
> 
>>> The problem with this is that the apache<->browser connection isn't
>>> "a" connection, it's a series of HTTP request/repsonse
>>> pairs. Originally, this implied tearing down and setting up a TCP
>>> connection for every request. Modern software will leave the link open
>>> and reuse it - but modern software also tends to have multiple
>>> connetions open, so it can fetch images and other embedded objects in
>>> parallel.
>> I'm lost here, better do some more reading
> 
> HTTP is a stateless protocol. Every HTTP request goes the same: the
> client sends a request saying what object it wants from the
> server. The server reads the request, and sends back the response,
> which is a collection of HTTP headers and a string of bytes. There's
> lots more details invovled, and various things you can do to enhance
> the performance of the system, but functionally they all boil down to
> that.
> 
>>> You can make this work, but doing it like that requires making
>>> multiple HTTP requests via the browser, which will be
>>> disconcerting. I'd recommend taking the browser out of the loop. Have
>>> the plugin talk directly to the server to do the
>>> authentication. That's what the latest web buzzword (AJAX) does:
>>> client-side software makes independent requests of the server (or
>>> *any* server) to get data, and possibly updates the document the
>>> browser is viewing as a result of that.
>> Here I think it's OK as the plugin can "talk" to server prior to the
>> browser showing anything.
> 
> If you say so. But certainly not through the browser.
> 
>>> So here's a scenario: the first cgi script gets info from the smart
>>> card that puts it in a hidden form element and sends the page to the
>>> browser. The plugin - started when the page loads - uses the DOM to
>>> get that data, then makes an *independent* HTTP request to the server,
>>> thus passing whatever it generated from the data in the form field to
>>> a second cgi script. This happens several times, then the plugin
>>> changes the HTML form to put whatever the cgi script generated into
>>> the form, so that when the user finally submits the form, the third
>>> cgi script - the one that handles the submitted form - sees the data
>>> from the second script.
>>> Actually, the exchanges between the

python cgi script not understood as html

2005-10-24 Thread Philippe C. Martin
Hi,

The following code outputs the actual HTML text to the browser, not the
interpreted text.

Any idea ?

Regards,

Philippe
import cgi
import logging
import auth #this is the one you must implement (or use SCF ;-)

html_ok = """
Content-Type: text/html\n
http://www.w3.org/TR/html4/loose.dtd";>\n
\n
\n
  Access Granted\n
  \n
  \n
\n
\n
Access Granted\n
\n
Welcome %s \n
\n
\n
\n
"""

html_nok = """
"Content-Type: text/html\n\n"
http://www.w3.org/TR/html4/loose.dtd";>



  Access Granted
  
  


Access Denied





"""
# DISPLAY ACCESS DENIED PAGE
def Failure():
print html_nok

#DISPLAY ACCESS GRANTED PAGE
def Success(p_data):
print html_ok % (p_data)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python cgi script not understood as html

2005-10-24 Thread Philippe C. Martin
the title should say "python cgi script html output not understood as html"


Philippe C. Martin wrote:

> Hi,
> 
> The following code outputs the actual HTML text to the browser, not the
> interpreted text.
> 
> Any idea ?
> 
> Regards,
> 
> Philippe
> import cgi
> import logging
> import auth #this is the one you must implement (or use SCF ;-)
> 
> html_ok = """
> Content-Type: text/html\n
>  "http://www.w3.org/TR/html4/loose.dtd";>\n
> \n
> \n
>   Access Granted\n
>   \n
>   \n
> \n
> \n
> Access Granted\n
> \n
> Welcome %s \n
> \n
> \n
> \n
> """
> 
> html_nok = """
> "Content-Type: text/html\n\n"
>  "http://www.w3.org/TR/html4/loose.dtd";>
> 
> 
> 
>   Access Granted
>   
>   
> 
> 
> Access Denied
> 
> 
> 
> 
> 
> """
> # DISPLAY ACCESS DENIED PAGE
> def Failure():
> print html_nok
> 
> #DISPLAY ACCESS GRANTED PAGE
> def Success(p_data):
> print html_ok % (p_data)

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


Re: python cgi script not understood as html

2005-10-24 Thread Philippe C. Martin
Many thanks !!

Regards,

Philippe



Mitja Trampus wrote:

> Philippe C. Martin wrote:
>> Hi,
>> 
>> The following code outputs the actual HTML text to the browser, not the
>> interpreted text.
>> 
>> Any idea ?
>> 
>> html_ok = """
>> Content-Type: text/html\n
>  > 
>  > ...
>  > """
> 
> Avoid the starting newline (before content-type).
> Add at least TWO newlines after content-type.
> 
> Or use a package to handle the HTTP stuff for you.

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


Re: python cgi script not understood as html

2005-10-24 Thread Philippe C. Martin
It is, thanks.

Philippe



Peter Hansen wrote:

> Philippe C. Martin wrote:
>> The following code outputs the actual HTML text to the browser, not the
>> interpreted text.
>> 
>> html_ok = """
>> Content-Type: text/html\n
>> > "http://www.w3.org/TR/html4/loose.dtd";>\n
> 
> HTTP header lines must end with \r\n, not just with \n.  Not sure this
> is the solution to your specific problem though...
> 
> -Peter

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


pyxpcom and firefox

2005-10-25 Thread Philippe C. Martin
Hi,

I write this post here because I do not manage to get in touch with mozilla
dev people:
***
[EVAL-IN]   irc.mozilla.org
[ERROR] ReferenceError: irc is not defined
***

I have two questions:
1) has anyone compiled/installed pyxpcom with firefox 1.5xx ?
2) is there a plan to make it a .xpi (the pyxpcom xpi for mozilla does not
install into firefox).

Regards,

Philippe



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


SCWEB 0.1 to be released

2005-10-25 Thread Philippe C. Martin
Dear all,

I intend to release withing the next very few week the version 0.1 of SCWEB,
a cross-platform web authentication platform _mostly_ written in Python and
adaptable to most programming languages.

SCWEB will come with server modules (cgi), client modules (Firefox
extension/plugin and XPCOM modules)

All modules are operational except for the XPCOM part.

I whised to announce the coming SCWEB now because I have opened a blog
(www.snakecard.com/WordPress) so I might potentially get important feedback
prior to the release.

SCWEB will be distributed under the GPL license.

Comments are quite welcome: www.snakecard.com/WordPress

Regards,

Philippe  Martin

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


Re: tool for syntax coloring in html

2005-10-26 Thread Philippe C. Martin
I use gvim.

regards,

Philippe



Xah Lee wrote:

> in some online documentations, for examples:
> 
> http://perldoc.perl.org/perlref.html
> http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme-Z-H-17.html
> http://www.haskell.org/hawiki/HaskellDemo
> 
> the codes are syntax colored.
> 
> Is there a tool that produce codes in html with syntax coloring?
> 
> Thanks.
> 
>  Xah
>  [EMAIL PROTECTED]
> ? http://xahlee.org/

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


scweb pre-release 0.1

2005-11-01 Thread Philippe C. Martin
Dear all,

referring to www.snakecard.com/WordPress:

As I am _very_ much struggling with xpcom and pyxpcom, I have put on
www.snakecard.com/SCWEB:

1) the cgi scripts
2) a firefox plugin which simulates the xpcom (ie: access to the external
device ... smart card) and talks to the cgi scripts

The project will also soon be hosted on: http://scwebxpcom.mozdev.org

Any info on xpcom/pyxpcom is quite welcome: the current xpcom component (c++
which does not register properly (sigh) is also on the site) ... any help
welcome.

Regards,

Philippe




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


SCLOGON 0.1 Smart Card event daemon for GNU/Linux

2005-11-05 Thread Philippe C. Martin

Dear all,

This is to announce the release of the event deamon I intend to use in
SCLOGIN; a GPL project that attempts to:
1) give the current logon managers (gdm, kdm, ...) the necessary plugins to
support vendor-independant smart card logon
2) be a complete logon manager itself

SCLOGIN will be discussed here: www.snakecard.com/WordPress and found here:
www.snakecard.com/SCLOGON.



Regards,

Philippe

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


Python gui

2005-11-05 Thread Philippe C. Martin
Hi,

Is wxWidget now part of python ? or will it be ?

regards,

Philippe


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


Re: Python gui

2005-11-05 Thread Philippe C. Martin
Thanks, Tkinter it is.

Regards,


Philippe

Diez B. Roggisch wrote:

> Philippe C. Martin wrote:
>> Hi,
>> 
>> Is wxWidget now part of python ? or will it be ?
> 
> 1) No. 2) I guess no. Because it has pretty heavy dependencies (wx,
> GTK/other toolkit)
> 
> 
> Tkinter is what comes ou of the box - and thats it.
> 
> Regards,
> 
> Diez

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


starting an X11 session from Python

2005-11-05 Thread Philippe C. Martin
Hi,

Have there been any attempt to do so, and is there any source out there that
could help me get started ?

Regards,

Philippe

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


Re: starting an X11 session from Python

2005-11-05 Thread Philippe C. Martin
Nothing, but that was not my question.

Regards,

Philippe


Sybren Stuvel wrote:

> Philippe C. Martin enlightened us with:
>> Have there been any attempt to do so, and is there any source out
>> there that could help me get started ?
> 
> What's stopping you from using system(), exec() or the likes to start
> "startx", "xinit" or simply "X"?
> 
> Sybren

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


Re: starting an X11 session from Python

2005-11-05 Thread Philippe C. Martin
PS: my goal is to write an equivalent of gdm/kdm/xdm ... in python

Regards,

Philippe


Philippe C. Martin wrote:

> Nothing, but that was not my question.
> 
> Regards,
> 
> Philippe
> 
> 
> Sybren Stuvel wrote:
> 
>> Philippe C. Martin enlightened us with:
>>> Have there been any attempt to do so, and is there any source out
>>> there that could help me get started ?
>> 
>> What's stopping you from using system(), exec() or the likes to start
>> "startx", "xinit" or simply "X"?
>> 
>> Sybren

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


Re: starting an X11 session from Python

2005-11-06 Thread Philippe C. Martin
Thanks I will look, I intend to use tkinter for the display as it is
built-in though.

Regards,

Philippe



Richard Townsend wrote:

> On Sat, 05 Nov 2005 19:51:40 +0000, Philippe C. Martin wrote:
> 
>> Hi,
>> 
>> Have there been any attempt to do so, and is there any source out there
>> that could help me get started ?
>> 
>> Regards,
>> 
>> Philippe
> 
> Have you tried:
> http://python-xlib.sourceforge.net/
> http://sourceforge.net/projects/python-xlib
> 

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


Tkinter and X11

2005-11-07 Thread Philippe C. Martin
Hi,

Is there anything that prevents tkinter from running prior to login to an
X11 session: as the X server is already up ?

Regards,


Philippe



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


Re: Tkinter and X11

2005-11-07 Thread Philippe C. Martin
Thanks jeff,

I actually want that Tkinter application to be the greater: replace gdm

Still feasible as far as Tkinter is conserned ?

Thanks and regards,

Philippe


[EMAIL PROTECTED] wrote:

> There should be no problem with this.  After all, even the "greeter" is
> just an
> X application.  Depending on which login manager you use
> (xdm/kdm/gdm/whatever) the details of getting your Tkinter app to actually
> be run will vary, though. In gdm, it looks like adding it to the file
> /etc/X11/gdm/Init/default may be the ticket.
> 
> It is probably best to run
> app.tk.call("rename", "send", "")
> in your program, for the reasons outlined in the send(n) manpage:
> SECURITY
> The  send  command is potentially a serious security loophole. On
> Unix,
> any application that can connect to your X server can send 
> scripts  to
> your  applications.   These  incoming  scripts  can use Tcl to
> read and
> write your files and invoke subprocesses under your  name.
> 
> Jeff

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


user account logon from python

2005-11-08 Thread Philippe C. Martin
Hi,

I am attempting to write a linux logon manager with python.

Can python access login APIs (which module ?) or do I need to write a
wrapper ?

Regards,

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


Re: user account logon from python

2005-11-08 Thread Philippe C. Martin
That helps a lot, thanks.

Regards,

Philippe


[EMAIL PROTECTED] wrote:

> "login APIs" vary widely from system to system.
> 
> Classic Unix systems use calls like getpwent and crypt to check passwords,
> and then call setuid, setgid and setgroups to set the identity of the user
> who is
> logging in.  These are all available in stock Python, check the library
> reference for more details.  Other login-time activities, like writing
> utmp entries, may not be directly available in stock Python modules.
> 
> Many modern Linux systems use something called 'pam' for login-related
> activities, and there seems to be something called 'python-pam' out there,
> but I've never used it.
> 
> Graphical login managers have their own additional requirements, such as
> starting and stopping the X server, managing the X authentication
> information, etc.
> 
> Jeff

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


Re: user account logon from python

2005-11-08 Thread Philippe C. Martin
Jeff,

1- I cannot find getpwent in the documentation
2- crypt will not work if the system does not have shadow pw
3- Even as root I get "Operation not permitted" using setuid and setgid ...
but I assume it is because I cannot get 1 and/or 2 to work.

Can you direct me to some link that would explain the actual procedure ?

Thanks,

Regards,

Philippe



[EMAIL PROTECTED] wrote:

> "login APIs" vary widely from system to system.
> 
> Classic Unix systems use calls like getpwent and crypt to check passwords,
> and then call setuid, setgid and setgroups to set the identity of the user
> who is
> logging in.  These are all available in stock Python, check the library
> reference for more details.  Other login-time activities, like writing
> utmp entries, may not be directly available in stock Python modules.
> 
> Many modern Linux systems use something called 'pam' for login-related
> activities, and there seems to be something called 'python-pam' out there,
> but I've never used it.
> 
> Graphical login managers have their own additional requirements, such as
> starting and stopping the X server, managing the X authentication
> information, etc.
> 
> Jeff

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


Re: user account logon from python

2005-11-08 Thread Philippe C. Martin
getting there, this sequence creates a file with the correct uid and gid

test_user_ids = 504
print os.setreuid(test_user_ids,0)
print os.setregid(test_user_ids,0)
print os.setuid(test_user_ids)
print os.setgid(test_user_ids)

print os.getuid()
f = open("/tmp/toto","w")
f.write("titi")
f.close()


Philippe C. Martin wrote:

> Jeff,
> 
> 1- I cannot find getpwent in the documentation
> 2- crypt will not work if the system does not have shadow pw
> 3- Even as root I get "Operation not permitted" using setuid and setgid
> ... but I assume it is because I cannot get 1 and/or 2 to work.
> 
> Can you direct me to some link that would explain the actual procedure ?
> 
> Thanks,
> 
> Regards,
> 
> Philippe
> 
> 
> 
> [EMAIL PROTECTED] wrote:
> 
>> "login APIs" vary widely from system to system.
>> 
>> Classic Unix systems use calls like getpwent and crypt to check
>> passwords, and then call setuid, setgid and setgroups to set the identity
>> of the user who is
>> logging in.  These are all available in stock Python, check the library
>> reference for more details.  Other login-time activities, like writing
>> utmp entries, may not be directly available in stock Python modules.
>> 
>> Many modern Linux systems use something called 'pam' for login-related
>> activities, and there seems to be something called 'python-pam' out
>> there, but I've never used it.
>> 
>> Graphical login managers have their own additional requirements, such as
>> starting and stopping the X server, managing the X authentication
>> information, etc.
>> 
>> Jeff

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


Re: user account logon from python

2005-11-08 Thread Philippe C. Martin
Hi Mike,


Mike Meyer wrote:
>> 1- I cannot find getpwent in the documentation
> 
> getpwent is a Unix library call. For python, you want the pwd
> module. The docs are http://docs.python.org/lib/module-pwd.html >.
> 

I must be blind but still do not see it - do you mean getpwnam ?


>> 2- crypt will not work if the system does not have shadow pw
> 
> Rubbish. crypt doesn't know anything about passord files. It just
> knows how to encrypt a password. It's up to you to get the password
> attempt from the user, and the encrypted password from the password
> file (or the shadow password file). The pwd module doesn't deal with
> shadow passwords. Maybe you meant "system does have shadow pw". But
> it's pwd that doesn't work, not crypt - and that depends on the
> system. For instance:
> 
I meant that the code form the documentation fails on the "raise", with the
error "Sorry, currently no support for shadow passwords"

What should I understand ?

import os


import crypt, getpass, pwd

def login():
username = raw_input('Python login: ')
cryptedpasswd = pwd.getpwnam(username)[1]
print cryptedpasswd
if cryptedpasswd:
if cryptedpasswd == 'x' or cryptedpasswd == '*': 
raise "Sorry, currently no support for shadow passwords"
cleartext = getpass.getpass()
return crypt.crypt(cleartext, cryptedpasswd) == cryptedpasswd
else:
return 1


> bhuda% cat tp.py
> #!/usr/bin/env python
> 
> import pwd, os
> 
> p = pwd.getpwnam(os.environ['USER'])
> print p[1]
> bhuda% ./tp.py
> *
> 
> But:
> 
> bhuda# ./tp.py
> $1$cKJbUtaY$y.e7GRjo8ePxgiBzskyRX0
> 
> I.e. - as me, the pwd routines won't return passwords. As root, it
> returns the encrypted password.
> 
>> 3- Even as root I get "Operation not permitted" using setuid and setgid
>> ... but I assume it is because I cannot get 1 and/or 2 to work.
> 
> They shouldn't have anything to do with it. Are you sure the process
> is running as root? For instance, most modern Unices won't honor the
> the setuid bit on script executables. You have to write a setuidj
> wrapper that runs the interpreter with the appropriate privileges.
> 
> http://mail.python.org/mailman/listinfo/python-list


SnakeCard goes open source

2005-11-13 Thread Philippe C. Martin
Dear all,

I have decided to focus my activities on development and support.

I will release SnakeCard's produt line source code under the GPL licence
this week (www.snakecard.com) ... I need to fix the site.

It includes:
SCF: SnakeCard Framework (software=Python)
SCFB: SnaleCard Framework Bundle (software=Python, applets BasicCard T=1,
JavaCard T=0)
SCALS: (software: Python (core), VB6 (GUI), C++ (GINA DLL), applets
BasicCard T=1, JavaCard T=0)
SC PCSC Server(software=Python)

Best regards,


Philippe


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


Re: SnakeCard goes open source

2005-11-13 Thread Philippe C. Martin
I forgot

SC-School-ID and SC-Corporate-ID: software = Python, GUI = wxWidget, Applets
JavaCard and BasicCard.

Regards,

Philippe


Philippe C. Martin wrote:

> Dear all,
> 
> I have decided to focus my activities on development and support.
> 
> I will release SnakeCard's produt line source code under the GPL licence
> this week (www.snakecard.com) ... I need to fix the site.
> 
> It includes:
> SCF: SnakeCard Framework (software=Python)
> SCFB: SnaleCard Framework Bundle (software=Python, applets BasicCard T=1,
> JavaCard T=0)
> SCALS: (software: Python (core), VB6 (GUI), C++ (GINA DLL), applets
> BasicCard T=1, JavaCard T=0)
> SC PCSC Server(software=Python)
> 
> Best regards,
> 
> 
> Philippe

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


SnakeCard products source code

2005-11-14 Thread Philippe C. Martin
Dear all,

The source code is available in the download section: www.snakecard.com

Regards,

Philippe

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


Re: SnakeCard products source code

2005-11-14 Thread Philippe C. Martin
I have not tested it with longhorn yet, but it works fine with XP-pro and
2000.

Regards,

Philippe



Kris wrote:

> Thanks for sharing it. I am interested in the GINA part.
> 
> 
> Philippe C. Martin wrote:
>> Dear all,
>>
>> The source code is available in the download section: www.snakecard.com
>> 
>> Regards,
>> 
>> Philippe

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


Python and U3 devices

2005-11-17 Thread Philippe C. Martin
Dear all,

Has anyone attempted to compile Python for a U3 device ?

Regards,

Philippe

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


SnakeCard on sourceforge

2005-11-18 Thread Philippe C. Martin
Dear all,

The SnakeCard product line is now hosted on sourceforge.net:

SCFB - http://sourceforge.net/projects/sctoolkits
SC-ID - http://sourceforge.net/projects/sc-id


I will keep posting the snapshots on www.snakecard.com as well as SCLOGON
and SCWEB until they take shape ;-)


Regards,

Philippe

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


compiling Python under Windows

2005-11-21 Thread Philippe C. Martin
Hi,

I'm currently blocking on bzip2:

python is in c:\python.2.4.2
and bz2 is in c:\bzip2-1.0.3

Since the readme say subprojects should be two directories above PCbuild, I
assume I'm OK.

I added c:\bzip2-1.0.3 to the include and link path, but I get:
"""
Performing Pre-Link Event ...
The system cannot find the path specified
NMAKE: fatal error U1052: file 'makefile.msc' not found

c:\bzip2-1.0.3 does hold a makefile.msc.

Any clue ?

Thanks,

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


Re: compiling Python under Windows

2005-11-21 Thread Philippe C. Martin
My mistake: The makefile (as written in the readme!) looks for bzip 1.0.2

Sorry,

Philippe



Philippe C. Martin wrote:

> Hi,
> 
> I'm currently blocking on bzip2:
> 
> python is in c:\python.2.4.2
> and bz2 is in c:\bzip2-1.0.3
> 
> Since the readme say subprojects should be two directories above PCbuild,
> I assume I'm OK.
> 
> I added c:\bzip2-1.0.3 to the include and link path, but I get:
> """
> Performing Pre-Link Event ...
> The system cannot find the path specified
> NMAKE: fatal error U1052: file 'makefile.msc' not found
> 
> c:\bzip2-1.0.3 does hold a makefile.msc.
> 
> Any clue ?
> 
> Thanks,
> 
> Philippe

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


Re: compiling Python under Windows

2005-11-21 Thread Philippe C. Martin
Philippe C. Martin wrote:

> My mistake: The makefile (as written in the readme!) looks for bzip 1.0.2
> 
PS: since bzip.org does not have 1.0.2 source anymore, can I just rename
1.0.3 ?

Regards,

Philippe


> Sorry,
> 
> Philippe
> 
> 
> 
> Philippe C. Martin wrote:
> 
>> Hi,
>> 
>> I'm currently blocking on bzip2:
>> 
>> python is in c:\python.2.4.2
>> and bz2 is in c:\bzip2-1.0.3
>> 
>> Since the readme say subprojects should be two directories above PCbuild,
>> I assume I'm OK.
>> 
>> I added c:\bzip2-1.0.3 to the include and link path, but I get:
>> """
>> Performing Pre-Link Event ...
>> The system cannot find the path specified
>> NMAKE: fatal error U1052: file 'makefile.msc' not found
>> 
>> c:\bzip2-1.0.3 does hold a makefile.msc.
>> 
>> Any clue ?
>> 
>> Thanks,
>> 
>> Philippe

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


Re: compiling Python under Windows

2005-11-21 Thread Philippe C. Martin
Thanks,

Regards,

Philippe


"Martin v. Löwis" wrote:

> Philippe C. Martin wrote:
>>>My mistake: The makefile (as written in the readme!) looks for bzip 1.0.2
>>>
>> 
>> PS: since bzip.org does not have 1.0.2 source anymore, can I just rename
>> 1.0.3 ?
> 
> That should work; alternatively, you can change the project file.
> 
> Regards,
> Martin

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


Python install minimum requirements

2005-11-21 Thread Philippe C. Martin
Hi,

I am attemtping to package Python in a "U3" install program for Windows.

I got Python to compile/link and prior to adding the necessary code for the
U3 SDK registration, I would like to know where I can find the actual list
of files needed for a minimum installation (are DLLs and libs enough ?)

Regards,

Philippe

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


Re: Python install minimum requirements

2005-11-22 Thread Philippe C. Martin
Thanks I'll take a look.

PS: www.u3.com

Regards,

Philippe



[EMAIL PROTECTED] wrote:

> If I found the right "U3" when I googled, then maybe this is relevant:
> http://www.voidspace.org.uk/python/movpy/
> 
> Jeff

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


Crash in python while run from U3 device

2005-11-26 Thread Philippe C. Martin
Hi,

I am currently porting some of my applications to U3 (www.u3.com) and I do
get a crash in ...objects\frameobject.c: PyFrameObject *back =
tstate->frame.

The point of the current test is to get a python function called on a U3
device event. (U3 only work with Windows currently).

My C stub callback does get called but crashes when it tries to call the
python function.



***
This is the function that registers the callback (actual dll prototype in
header):
***
static PyObject *s_callback=NULL;
/**/
/**/
/* HRESULT dapiRegisterCallback(   HSESSION hSession ,wchar_t*
pszConnectionString ,DAPI_CALLBACK pCallBack,void* pEx ,HCALLBACK*
hCallback) */
/**/
/**/

static PyObject *Py_dapiRegisterCallback(PyObject *p_self, PyObject *p_args)
{
HRESULT l_result;
HSESSION l_hSession;
wchar_t* l_pszConnectionString;
PyObject *l_tmp_cb;
//PyObject cs;
void* l_pEx;
HCALLBACK l_hCallback;

if
(!PyArg_ParseTuple(p_args,"iuOi",&l_hSession,&l_pszConnectionString,&l_tmp_cb,&l_pEx)
 )
{
BAD_PARAM;
return NULL;
}
//l_pszConnectionString = PyObject_Unicode(cs);
Py_XINCREF(l_tmp_cb);
Py_XDECREF(s_callback);
s_callback=l_tmp_cb;
l_result =
dapiRegisterCallback(l_hSession,l_pszConnectionString,Stub_Callback,l_pEx,&l_hCallback);

CHECK_RESULT;

return Py_BuildValue("l",l_hCallback);

}

***
This is the stub callback that crashes:
***
void _stdcall Stub_Callback(HDEVICE p_dev, DWORD p_event, void *p_pEx)
{
PyObject *l_result;
PyObject *l_arg_list;

l_arg_list = Py_BuildValue("(iii)", p_dev,p_event,p_pEx);
l_result = PyEval_CallObject(s_callback, l_arg_list); /*No crash if I
comment this line*/
Py_DECREF(l_arg_list);
}


*
This is the python source
*
(cs, and s have a correct value ... I think )
import u3
def mf(a,b,c):
   print 'CB'

h=u3.dapiRegisterCallback(s, cs, mf, 0)




Any help _greatly_ appreciated.

Regards,

Philippe




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


Re: Crash in python while run from U3 device

2005-11-26 Thread Philippe C. Martin
Philippe C. Martin wrote:

> Hi,
> 
> I am currently porting some of my applications to U3 (www.u3.com) and I do
> get a crash in ...objects\frameobject.c: PyFrameObject *back =
> tstate->frame.
> 
> The point of the current test is to get a python function called on a U3
> device event. (U3 only work with Windows currently).
> 
> My C stub callback does get called but crashes when it tries to call the
> python function.
> 
> 
> 
> ***
> This is the function that registers the callback (actual dll prototype in
> header):
> ***
> static PyObject *s_callback=NULL;
> /**/
> /**/
> /* HRESULT dapiRegisterCallback(   HSESSION hSession ,wchar_t*
> pszConnectionString ,DAPI_CALLBACK pCallBack,void* pEx ,HCALLBACK*
> hCallback) */
> /**/
> /**/
> 
> static PyObject *Py_dapiRegisterCallback(PyObject *p_self, PyObject
> *p_args)
> {
> HRESULT l_result;
> HSESSION l_hSession;
> wchar_t* l_pszConnectionString;
> PyObject *l_tmp_cb;
> //PyObject cs;
> void* l_pEx;
> HCALLBACK l_hCallback;
> 
> if
>
(!PyArg_ParseTuple(p_args,"iuOi",&l_hSession,&l_pszConnectionString,&l_tmp_cb,&l_pEx)
> )
> {
> BAD_PARAM;
> return NULL;
> }
> //l_pszConnectionString = PyObject_Unicode(cs);
> Py_XINCREF(l_tmp_cb);
> Py_XDECREF(s_callback);
> s_callback=l_tmp_cb;
> l_result =
>
dapiRegisterCallback(l_hSession,l_pszConnectionString,Stub_Callback,l_pEx,&l_hCallback);
> 
> CHECK_RESULT;
> 
> return Py_BuildValue("l",l_hCallback);
> 
> }
PS: the crash is in PyFrame_New

Thanks,

Philippe



> 
> ***
> This is the stub callback that crashes:
> ***
> void _stdcall Stub_Callback(HDEVICE p_dev, DWORD p_event, void *p_pEx)
> {
> PyObject *l_result;
> PyObject *l_arg_list;
> 
> l_arg_list = Py_BuildValue("(iii)", p_dev,p_event,p_pEx);
> l_result = PyEval_CallObject(s_callback, l_arg_list); /*No crash
> if I
> comment this line*/
> Py_DECREF(l_arg_list);
> }
> 
> 
> *
> This is the python source
> *
> (cs, and s have a correct value ... I think )
> import u3
> def mf(a,b,c):
>print 'CB'
> 
> h=u3.dapiRegisterCallback(s, cs, mf, 0)
> 
> 
> 
> 
> Any help _greatly_ appreciated.
> 
> Regards,
> 
> Philippe

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


Re: Crash in python while run from U3 device

2005-11-26 Thread Philippe C. Martin
PS: I should add that the U3 device does not actually run Python, but copies
it to the PC and launches it: I'm almost certain this is a bug in my code.

Help please !

Regards,

Philippe



Philippe C. Martin wrote:

> Hi,
> 
> I am currently porting some of my applications to U3 (www.u3.com) and I do
> get a crash in ...objects\frameobject.c: PyFrameObject *back =
> tstate->frame.
> 
> The point of the current test is to get a python function called on a U3
> device event. (U3 only work with Windows currently).
> 
> My C stub callback does get called but crashes when it tries to call the
> python function.
> 
> 
> 
> ***
> This is the function that registers the callback (actual dll prototype in
> header):
> ***
> static PyObject *s_callback=NULL;
> /**/
> /**/
> /* HRESULT dapiRegisterCallback(   HSESSION hSession ,wchar_t*
> pszConnectionString ,DAPI_CALLBACK pCallBack,void* pEx ,HCALLBACK*
> hCallback) */
> /**/
> /**/
> 
> static PyObject *Py_dapiRegisterCallback(PyObject *p_self, PyObject
> *p_args)
> {
> HRESULT l_result;
> HSESSION l_hSession;
> wchar_t* l_pszConnectionString;
> PyObject *l_tmp_cb;
> //PyObject cs;
> void* l_pEx;
> HCALLBACK l_hCallback;
> 
> if
>
(!PyArg_ParseTuple(p_args,"iuOi",&l_hSession,&l_pszConnectionString,&l_tmp_cb,&l_pEx)
> )
> {
> BAD_PARAM;
> return NULL;
> }
> //l_pszConnectionString = PyObject_Unicode(cs);
> Py_XINCREF(l_tmp_cb);
> Py_XDECREF(s_callback);
> s_callback=l_tmp_cb;
> l_result =
>
dapiRegisterCallback(l_hSession,l_pszConnectionString,Stub_Callback,l_pEx,&l_hCallback);
> 
> CHECK_RESULT;
> 
> return Py_BuildValue("l",l_hCallback);
> 
> }
> 
> ***
> This is the stub callback that crashes:
> ***
> void _stdcall Stub_Callback(HDEVICE p_dev, DWORD p_event, void *p_pEx)
> {
> PyObject *l_result;
> PyObject *l_arg_list;
> 
> l_arg_list = Py_BuildValue("(iii)", p_dev,p_event,p_pEx);
> l_result = PyEval_CallObject(s_callback, l_arg_list); /*No crash
> if I
> comment this line*/
> Py_DECREF(l_arg_list);
> }
> 
> 
> *
> This is the python source
> *
> (cs, and s have a correct value ... I think )
> import u3
> def mf(a,b,c):
>print 'CB'
> 
> h=u3.dapiRegisterCallback(s, cs, mf, 0)
> 
> 
> 
> 
> Any help _greatly_ appreciated.
> 
> Regards,
> 
> Philippe

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


SCU3 and Python packaged for U3 (with SCU3) V 0.1 released

2005-11-27 Thread Philippe C. Martin
Dear all,

I am very happy to announce the release of SCU3 V 0.1 and SCU3Python.u3p V.
0.1.

SCU3 is a python wrapper for U3 compliante devices
SCU3Python.u3p is a Python binary (2.4.2) packaged with SCU3 that allows to
launch idle from the U3 device launchpad

Both may be found on www.snakecard.com, download section.

Best regards,

Philippe


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


Re: Writing pins to the RS232

2005-11-28 Thread Philippe C. Martin
Hi,

Some of it should be doable on windows:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcecoreos5/html/wce50lrfescapecommfunction.asp

Yet this might require a new wrapper module for I am not sure what the
current interface lets you do.

Not sure about Linux.

Regards;

Philippe







On Fri, 25 Nov 2005 13:25:44 -0800, [EMAIL PROTECTED] wrote:

> I want to write to the pins of an RS232 without using the serial
> protocol.  The use would be every pin could act to complete a circuit
> in customized hardware.  I could use python to communicate serially to
> a BASIC stamp or a Javelin stamp and then use the stamp to set however
> many pins as 0's or 1's but should it be that hard to do with python.
> I've looked through how python does serial with the "serial" module but
> it just uses Java's javax.comm libraries.  Is there anyway to do very
> low level device writing to COM ports?
> 
> In summary I'm looking for something like:
> ser = serial.Serial(0)
> ser.pin0 = 1
> ser.pin1 = 1
> ser.pin2 = 1
> 
> 
> 
> or
> ser.write('0xFF')
> which would set 8 pins on the RS232 cable to 1's

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


SCU3 Python package 0.2 released: wxPython support added

2005-12-01 Thread Philippe C. Martin
Dear all,

I have released SCU3Python.u3p (www.snakecard.com/src) .

It includes:
- SCU3 0.1: a python wrapper for the U3 SDK (www.u3.com)
- Python 2.4.2
- wxPython 2.6 (ansi)
- A hello-World-style basic wxPython application which shows how to retrieve
 the U3 information (ex: current virtual disks) necessary for U3 compliance.

Best regards,

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


Re: how to run an external program...

2005-12-01 Thread Philippe C. Martin
hi,

What do you need by "control" ?

look at os.system/execv/popen ...;

Regards,

Philippe


On Thu, 01 Dec 2005 11:57:03 -0800, ash wrote:

> hi,
> i want to know is there a way to run/control an external program form
> within a python program?
> thanks in advance for any support.

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


os.chdir + GUI question

2005-12-03 Thread Philippe C. Martin
Hi,

I do not know whether this is a Python, wxPython, Windows, or coding 
question ...

I have a program that changes disk/directory using os.chdir (verified OK 
with os.getcwd) then opens a file dialog box using wx.FileDialog with "" 
as default dir.

I expected to be in my chdir directory but found myself in the windows 
desktop.

Any clue ?

Regards,

Philippe



-- 
SnakeCard, LLC
Philippe C. Martin
www.snakecard.com


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


SCPocketGrades released

2005-12-03 Thread Philippe C. Martin
Dear all,

I am very pleased to announce the release of SCPocketGrades V 0.1.

SCPocketGrades is a GPL U3 smart drive-based grade book application.

SCPocketGrades is coded in Python, wxPython, and C.

SCPocketGrades' main features are:

 - (U3): no PC installation + data saved on smart drive (no more grading at 
school during the week-ends)
 - Multiple class management
 - csv import/export
 - share class data (ex: with substitute teacher)
 - Curve support
 - Category/weight support
 - Reporting (filter by date/category/assignment/student/class):
   Data plotting/export
   Html formatted report mailing (configure your email settings from the 
application)
 - Missing/excused assignment support




SCPocketGrades may be found on www.snakecard.com, download section. 


For supported OS list, please see www.u3.com

Please note that SCPocketGrades has not yet obtained the U3 logo

For those interested in looking at the source code, rename
SCPocketGrades.u3p to SCPocketGrades.zip and unzip. Screenshots also
available.

(Commercial support/customization available)


Regards,

Philippe

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


Re: SCPocketGrades released

2005-12-03 Thread Philippe C. Martin
oops: www.snakecard.com/src

On Sat, 03 Dec 2005 12:26:52 -0600, Philippe C. Martin wrote:

> Dear all,
> 
> I am very pleased to announce the release of SCPocketGrades V 0.1.
> 
> SCPocketGrades is a GPL U3 smart drive-based grade book application.
> 
> SCPocketGrades is coded in Python, wxPython, and C.
> 
> SCPocketGrades' main features are:
> 
>  - (U3): no PC installation + data saved on smart drive (no more grading at 
> school during the week-ends)
>  - Multiple class management
>  - csv import/export
>  - share class data (ex: with substitute teacher)
>  - Curve support
>  - Category/weight support
>  - Reporting (filter by date/category/assignment/student/class):
>Data plotting/export
>Html formatted report mailing (configure your email settings from the 
> application)
>  - Missing/excused assignment support
> 
> 
> 
> 
> SCPocketGrades may be found on www.snakecard.com, download section. 
> 
> 
> For supported OS list, please see www.u3.com
> 
> Please note that SCPocketGrades has not yet obtained the U3 logo
> 
> For those interested in looking at the source code, rename
> SCPocketGrades.u3p to SCPocketGrades.zip and unzip. Screenshots also
> available.
> 
> (Commercial support/customization available)
> 
> 
> Regards,
> 
> Philippe

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


shelve seg error

2005-12-06 Thread Philippe C. Martin
Hi,

I just installed (compiled) Python 2.4.2 under Suse 10.

The following code generates a seg error:

import shelve
print shelve.open ('test')

I assume this has to do with the db behind shelve.

How do I go about tracing/fixing the problem ?

Regards,

Philippe

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


Re: shelve seg error

2005-12-06 Thread Philippe C. Martin
PS:

This code however works, which seems to me means the problem is with the
default database used by shelve ... which one is it ?


import shelve
import gdbm

def gdbm_shelve(filename, flag="c"):
return shelve.Shelf(gdbm.open(filename, flag))

db = gdbm_shelve("dbfile")


Regards,

Philippe




On Tue, 06 Dec 2005 05:53:22 -0600, Philippe C. Martin wrote:

> Hi,
> 
> I just installed (compiled) Python 2.4.2 under Suse 10.
> 
> The following code generates a seg error:
> 
> import shelve
> print shelve.open ('test')
> 
> I assume this has to do with the db behind shelve.
> 
> How do I go about tracing/fixing the problem ?
> 
> Regards,
> 
> Philippe

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


Re: shelve seg error

2005-12-06 Thread Philippe C. Martin
Can I ask anydb which db it's using ?

Regards,

Philippe



On Tue, 06 Dec 2005 15:07:19 +0100, Fredrik Lundh wrote:

> Philippe C. Martin wrote:
> 
>> This code however works, which seems to me means the problem is with the
>> default database used by shelve ... which one is it ?
> 
> http://docs.python.org/lib/module-anydbm.html
> 
> 

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


Re: shelve seg error

2005-12-07 Thread Philippe C. Martin
OK, Thanks

On Tue, 06 Dec 2005 15:41:08 +0100, Fredrik Lundh wrote:

> Philippe C. Martin wrote:
> 
>> Can I ask anydb which db it's using ?
> 
> the page says
> 
> If the database file already exists, the whichdb module is used to 
> determine its
> type and the appropriate module is used; if it does not exist, the first 
> module
> listed above that can be imported is used
> 
> where "above" refers to the list
> 
> dbhash (requires bsddb), gdbm, or dbm. If none of these modules is 
> installed,
> the slow-but-simple implementation in module dumbdbm will be used.
> 
> so the culprit in your case is either whichdb itself, or dbhash/bsddb...
> 
> 

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


Tkinter zoom box

2005-01-03 Thread Philippe C. Martin
Hi,

I have the following convern: I have Tkinter applications that require a zoom 
box, and have had the following behavior without changing a line of code:

1) Mandrake 10.0/KDE 3.2/Python 2.3: no zoom box 
2) Mandrake 10.0/KDE 3.2/Python 2.4: zoom box shows
3) Mandrake 10.1/KDE 3.3/Python 2.4: no zoom box
4) Mandrake 10.1/Gnome 2.6/Python 2.4: zoom box shows

I know that sounds strange, but I am fairly certain this is what happened.

Is there a way to _force_ that zoom box ?

Regards,

Philippe




-- 
*
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
*
-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter zoom box = maximize/unmaximize box/button

2005-01-03 Thread Philippe C. Martin
By zoom box I meant one of the top right button/box one uses to 
maximize/unmaximize the current window.




-- 
*
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
*
-- 
http://mail.python.org/mailman/listinfo/python-list


smtp question

2005-01-05 Thread Philippe C. Martin
Hi,

I am testing the smtp module and have the following question:

in the code below (taken from net sample) prior to adding the "Subject:"
field, the email client found the "From" and the "To". Without the
"Subject:" field on I get this:

Email client = Evolution: the "From" field is blank
Email client = KMail: the "To" field is blank

Any clue ?

Thanks and regards,

Philippe
**

import smtplib

def prompt(prompt):
return raw_input(prompt).strip()


fromaddr = prompt("From: ")
toaddrs  = prompt("To: ").split()
print "Enter message, end with ^D (Unix) or ^Z (Windows):"

# Add the From: and To: headers at the start!
msg = ("From: %s\r\nTo: %s\r\n\r\n" % (fromaddr, ", ".join(toaddrs)))
while 1:
try:
line = raw_input()
except EOFError:
break
if not line:
break
msg = msg + line
  
print "Message length is " + repr(len(msg))
  
server = smtplib.SMTP('smtp.sbcglobal.yahoo.com')
server.set_debuglevel(1)
server.login ('x','yyy')
server.sendmail(fromaddr, toaddrs, 'Subject:from python\n\n'+msg)
server.quit()









-- 
***
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

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


smtp: one more question

2005-01-05 Thread Philippe C. Martin
>Email client = Evolution: the "From" field is blank
>Email client = KMail: the "To" field is blank

I also notice that emails sent to myself get trashed by my provider -
could that be related ?




-- 
***********
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

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


Re: smtp question - using email module

2005-01-05 Thread Philippe C. Martin
Thank you all for your help - an yes! the email module is _very_ nice.

Regards,

Philippe

-- 
***
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

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


Re: Developing Commercial Applications in Python

2005-01-07 Thread Philippe C. Martin
> 
>> Can somebody there to point me any good commercial applications
>> developed using python ?
> 


Only time will tell if SCF is a _good_ commercial application, but it
will be released on my site as soon as I get my export license from the
BIS.

_and_ I will certainly announce it on this list :-)

Regards,

Philippe




-- 
*******
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

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


Tkinter: passing parameters to menu commands

2005-01-07 Thread Philippe C. Martin
Hi,

I have he following need and do not find an easy way out:

I have many menu items and would like them all to call the same method
-However, I need the method called to react differently depending on the
menu item selected. Since the menu command functions do not seem to
receive any type of event style object, is there some type of Tkinter
call that would let my method know the menu id selected ?

Philippe




-- 
***
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

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


Re: Tkinter: passing parameters to menu commands

2005-01-07 Thread Philippe C. Martin
>>menu.add_cascade(label="File", menu=filemenu)
>>filemenu.add_command(label="New", command=lambda: callback('New'))
>>filemenu.add_command(label="Open...", command=lambda:
callback('Open'))
>>filemenu.add_separator()
>>filemenu.add_command(label="Exit", command=lambda: callback('Exit'))
mainloop()
>>Of course you could do this with named forwarding functions if you
prefer


I'm not sure what 'named forwarding functions' are but I'm actually in a
class and when applying your suggestion in the following manner,
everything works (THANKS!)


def __Dec(self,p_string):
  for i in p_string:
self.__Insert(i)
.
.
.
#menu creation
l_dec.add_command(label = 'ATR', command=lambda: self.__Dec('ATR'))
l_dec.add_command(label = 'IN', command=lambda:self.__Dec('IN'))
.
.
.


Yet I have a question:

If I replace the menu creation code as below, and since __Insert appends
the string p_string into a text widget that is created _after_ the menu
creation; the method __Dec seems to be called at the menu creation and
I get an error in __Insert because the test widget is equal to None.

My reflexes of C programmer tell me that command=self.__Dec just
passes a method pointer (sorry I said it) to add_command - yet it does
not seem to be so.

What is actually going on ?


#menu creation
l_dec.add_command(label = 'ATR', command=self.__Dec('ATR'))
l_dec.add_command(label = 'IN', command=self.__Dec('IN'))





Regards,

Philippe




-- 
***
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

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


Re: Tkinter: passing parameters to menu commands (looping through a list)

2005-01-07 Thread Philippe C. Martin
I face a strange behavior when adding menu labels / command parameters
from a list:

*** 
This is the code that works but I wish to avoid - ATR and IN appear in
the menu, and __Dec is called with ATR or IN depending on the choice
***
l_dec.add_command(label = 'ATR', command= lambda: self.__Dec('ATR'))
l_dec.add_command(label = 'IN', command= lambda: self.__Dec('IN'))

*** 
This is the code that does not works but I wish I had - ATR and IN
appear in the menu, but __Dec is always called with the last list item
(IN in this case)

***
l_dec_list = ['ATR','IN']

for i in l_dec_list:
  l_dec.add_command(label = i, command= lambda: self.__Dec(i))



Any clue ?

Regards,

Philippe


-- 
***
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

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


Re: Tkinter: passing parameters to menu commands (looping through a list)

2005-01-07 Thread Philippe C. Martin
>>l_dec.add_command(label=i, command=lambda x=i: self.__Dec(x))

Woof! I'd better do my homework on lambda !

Thanks,

Philippe



-- 
***
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

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


Re: "A Fundamental Turn Toward Concurrency in Software"

2005-01-08 Thread Philippe C. Martin
I remember a _few_ year ago when all specialists (Intel's) included
agreed that the 100MHZ barrier would never be passed - so, at least, we
did get free lunch for a couple of years :-)

I also must add that in my 17 years of realtime/embedded programming,
the problem usually was not the CPU speed - since you know _prior_ to
the design of your software whether your CPU will change context on time
when the hardware IRQ comes in - but rather the fact that all the
software/peripherals had to share the same bus ==> that usually was
where the bottleneck was.

I guess my point is to not focus the performance of a system solely on
its CPU's.




Regards,

Philippe




-- 
*******
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

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


printing line numbers for debugging purpose

2005-01-08 Thread Philippe C. Martin
Hi,

All of the methods from my program return None on error (i.e; I do not
want to assert and have the program exit).

Is it possible to print the current source file name/line number ?

ex: in C/C++ I would use the macros __FILE__ and __LINE__.

Regards,

Philippe



-- 
***
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

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


fetching method names from a class, and the parameter list from a method

2005-01-10 Thread Philippe C. Martin
Is this possible ?

I am trying to have auto-completion working in a shell I wrote but I
currently have the method lists done by hand (ie; if I add/subtract a
method from that class, then my auto-completion is out of date).

Same issue with method parameters.

I have parsed through many of the attributes (ex: I use method.__doc__)
but have not yet found a way to achieve the above goal.

Is there a way? something like the following would be great:
1) list = Class.__methods__
2) dict (because of default values: "param = None") =
Class.__method__[0].__params__



Regards,


Philippe



-- 
***
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

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


Re: fetching method names from a class, and the parameter list from a methodRe: fetching method names from a class, and the parameter list from a method

2005-01-11 Thread Philippe C. Martin
>>> import inspect
>>> help(inspect)


Thanks,

I have not seen the func params yet, but the default values are so 

Regards,

Philippe

-- 
*******
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

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


Re: encryption/decryption help

2005-01-12 Thread Philippe C. Martin
Did you look at pycrypto ?


http://www.amk.ca/python/code/crypto.html



Regards,


Philippe




-- 
***
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

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


Re: encryption/decryption help

2005-01-12 Thread Philippe C. Martin
>>MD5 and SHA are by their very nature one way encryption. You cannot 
decrypt them.

Indeed, the point of these algorithms is to sign data (like a
fingerprint).

In order to encrypt you may go for Symmetrical algos (AES, 3DES with
those, the key must be known on both sides of the pipe) or Asymmetrical
(RSA ... - where you get a private key on one side and a public key on
the other - good but slow).

Often you find hybrid methods: you start your session with a
public/private style method just to exchange a symmetrical key that
you'll use for the rest of the session.

Regards,

Philippe



-- 
***
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

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


how to find site-packages path

2005-01-17 Thread Philippe C. Martin
Hi,

I am using my own install script for my software and am looking for a
flawless way to figure out where python, and more specifically
site-packages is installed.

Any clue ?

Regards,

Philippe



-- 
***
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

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


Re: how to find site-packages path (Michael Hoffman) - use distutils

2005-01-17 Thread Philippe C. Martin
>>The flawless way would be to use distutils. In fact you shouldn't even
>>need your own install script--it should do most of the work for you.

The reason I have not so far is I have not found a way to get what I
want done:

1) create directories in site-packages (I gather this shoudl be easy
enough)
2) copy already compiled (.pyc) and source (.py) files to those
directories
3) create directories and copy files in a directory kept in an
environment variable


Can distutils do this for me ?


Regards,

Philippe





-- 
*******
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

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


Re: how to find site-packages path (Michael Hoffman) - use distutils

2005-01-18 Thread Philippe C. Martin
>> Why would you want to copy any *.pyc instead of compiling them on
site?



I know that sounds terrible to the open source community, but I do not
intend to release the source code for my product - pls go to
philippecmartin.com/applications.html for my _small_ contributions :-))

Regards,

Philippe



-- 
***
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

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


Tkinter in thread hangs on windows but not on Linux

2005-01-18 Thread Philippe C. Martin
Hi,

I need to pop-up in a "modless" manner some windows from an existing
Tkinter loop. The following code works OK under Linux: the second window
opens, shows the information, and quits cleanly when destroyed. However,
under windows, I get the second window without the content (so I hang in
run I guess), and both the thread and the calling process hang.

Any clue ?

Thanks
Philippe





#***
class SC_DOCS(threading.Thread):
  __m_smg = None
  __m_title = None
  def __init__(self,p_msg,p_title):
threading.Thread.__init__(self)
self.__m_msg = p_msg
self.__m_title = p_title

#***
  def run (self):
l_r = Tk()
l_r.title(self.__m_title)
l_f = Frame(l_r)
l_f.pack(side=TOP, expand=YES, fill=BOTH)
l_st = ScrolledText(l_f)
l_st.pack(side=TOP, expand=YES, fill=BOTH)
l_st.insert(END,self.__m_msg)

l_r.mainloop()


.
.
.

l_d = SC_DOCS('A MESSAGE', 'A TITLE')
l_d.start()


.
.
.
-- 
***********
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

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


Re: hex notation funtion

2005-01-18 Thread Philippe C. Martin
Would that do it?

for i in my_byte_string:
   = atoi(binascii.hexlify(i),16)

Regards,

Philippe





On Tue, 18 Jan 2005 20:43:44 +0200, tertius wrote:

> Hi,
> 
> Is there a builtin function that will enable me to display the hex 
> notation of a given binary string? (example below)
> 
> many thanks
> Tertius
> 
> 
> 
> ()  02 11 00 00 46 5A 1A 82  02 11 00 39 36 39 33 39 
> FZ.96939
> 
> 0016(0010)  36 39 33 00 0A 30 33 37  34 34 39 35 38 25 DD 01 
> 693..03744958%..

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


Re: how to find site-packages path (Michael Hoffman) - use distutils

2005-01-18 Thread Philippe C. Martin
I actually target Unix and windows so pyexe won't cut it I'm afraid -
same issue with Inno.

As far as the site-package target, I don't fully understand your
relunctancy. Just as my potential users might not own a compiler, they
might not be computer proficient enough to easily understand how to
change the sys.path. So until I have found a clean cross platform
solution I'm going to have to stick to site-packages.

Best regards,

Philippe




-- 
*******
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

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


Re: Tkinter in thread hangs on windows but not on Linux

2005-01-18 Thread Philippe C. Martin
Well this is what is on the top of my script:
from Tkinter import *
import threading
from ScrolledText import *

I still hang under XP  wish I had 2K to test.

I almost sounds like tkinter does not get refresh events anymore.

I'll keep at it







On Tue, 18 Jan 2005 12:42:21 -0800, Kamilche wrote:

> This example worked for me on Windows 2000, after inserting
> 
> import threading
> from Tkinter import *
> import ScrolledText
> 
> 
> at the top.

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


Re: Tkinter in thread hangs on windows but not on Linux

2005-01-18 Thread Philippe C. Martin
Actually, the following link:
http://www.astro.washington.edu/owen/TkinterSummary.html
seems to say my code is illegal - so I'm now just launching a modless
window from the main thread - _seems_ to work




On Tue, 18 Jan 2005 11:45:28 +0100, Philippe C. Martin wrote:

> Hi,
> 
> I need to pop-up in a "modless" manner some windows from an existing
> Tkinter loop. The following code works OK under Linux: the second window
> opens, shows the information, and quits cleanly when destroyed. However,
> under windows, I get the second window without the content (so I hang in
> run I guess), and both the thread and the calling process hang.
> 
> Any clue ?
> 
> Thanks
> Philippe
> 
> 
> 
> 
> 
> #***
> class SC_DOCS(threading.Thread):
>   __m_smg = None
>   __m_title = None
>   def __init__(self,p_msg,p_title):
> threading.Thread.__init__(self)
> self.__m_msg = p_msg
> self.__m_title = p_title
> 
> #***
>   def run (self):
> l_r = Tk()
> l_r.title(self.__m_title)
> l_f = Frame(l_r)
> l_f.pack(side=TOP, expand=YES, fill=BOTH)
> l_st = ScrolledText(l_f)
> l_st.pack(side=TOP, expand=YES, fill=BOTH)
> l_st.insert(END,self.__m_msg)
> 
> l_r.mainloop()
> 
> 
> .
> .
> .
> 
> l_d = SC_DOCS('A MESSAGE', 'A TITLE')
> l_d.start()
> 
> 
> .
> .
> .

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


Re: how to find site-packages path (Michael Hoffman) - use distutils/modified

2005-01-19 Thread Philippe C. Martin
Thanks David.

Philippe



>>Hi Philippe

>>You may want to have a look at 
>>https://sourceforge.net/tracker/?func=detail&atid=305470&aid=793070&group_id=5470

>>This was originally a patch to distutils which enabled removing the 
>>source (i.e. only distributing compiled files). I have now attached a 
>>file there which enables you to do the same thing, but without
patching 
>>distutils - it just wraps functions etc from outside.

>>Basically you call allow_distutils_remove_source in the module and it 
>>does the neccessary changes. Then you get a --remove-source options
to 
>>most of the commands. You can also selectively override what gets 
>>removed if you want by changing the is_removable function

>>I hope this is useful for what you're wanting to do

>>David
-- 
***
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

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


Re: [OT] Good C++ book for a Python programmer

2005-01-19 Thread Philippe C. Martin
I suggest you google 'C++ tutorial'

Regards,

Philippe



On Wed, 19 Jan 2005 04:08:16 -0800, [EMAIL PROTECTED] wrote:

> I'm picking up C++ again after years of using almost nothing but
> Python. I'm frankly enjoying the experience, and it's certainly
> deepening my appreciation of Python (which you can read however you
> like).
> 
> I was wondering whether anyone could recommend a good C++ book, with
> "good" being defined from the perspective of a Python programmer. I
> realize that there isn't a book titled "C++ for Python Programmers",
> but has anyone found one that they think goes particularly well with
> the Python way?
> 
> I'm asking this because evidently the C++ standard has changed a bit
> since 1994, when I bought my books. Who knew that fstream was
> deprecated?
> 
> Thanks in advance...

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


Re: What's the best python web-developer's editor

2005-01-21 Thread Philippe C. Martin
>>Emacs
>>For both discrete and mixed python and html code,  and why?
>>There's no reason to use anything else.


Although I tested and will keep testing other editors/ide, I also went
back to emacs and am quite happy with it. However, I sometimes use
snavigator (http://sourceforge.net/projects/sourcenav) when I need to
browse through a project (although I could use emacs TAGS, I find
snavigator to be the best free solution out there to parse large
projects)

Regards,

Philippe





-- 
*******
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

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


Re: What is print? A function?

2005-01-24 Thread Philippe C. Martin
Why don't you redirect stdout or stderr


#***
class Debug_Stderr:
  __m_text = ''
  __m_log_text = None
  __m_dbg = None
  __m_refresh_count = 0
#***
  def __init__(self):
#***
  def write(self,p_string):
 #your code here




.
.
.
my_debug = Debug_Stderr()
sys.stderr = my_debug

print >> sys.stderr, 'this will go into the above write method'





-- 
*******
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

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


RE:"private" variables a.k.a. name mangling (WAS: What is print? A function?)

2005-01-24 Thread Philippe C. Martin

I use "__"for private variables because I must have read on net it was
the way to do so - yet this seems to have changed - thanks:

http://www.network-theory.co.uk/docs/pytut/tut_77.html


As far as the specific stderr reroute example - I just grabbed some of
my code and forgot to get rid of that stuff


Regards,


Philippe



-- 
***
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

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


RE: Why I use private variables (WAS: RE:"private" variables a.k.a. name mangling?)

2005-01-24 Thread Philippe C. Martin
The real reason behind my using private variables is so they do not
appear in the epydoc generated documentation and confuse my users.

Regards,

Philippe




-- 
***
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***

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


RE: Why I use private variables (WAS: RE:"private" variables a.k.a. name mangling?)

2005-01-24 Thread Philippe C. Martin
I used double underscore because I thought it was the correct way to name
private variables/methods - I will have to change those to single
underscore since that it the current methodology.

A private variable to me:
1) is internal to the processing of a class and needs not be accessed by
external or derivated objects. (I won't get into the
potential need of "protected" variables/methods - Python creators have not
made those distinctions for reasons that they believe are good and I'm not
the one to discuss them)
2) Must not be documented to library users as they're using it would
go againts 'law' 1).
3) I wish I had one, but there is only one Isaac Asimov after all :-)

Regards,

Philippe








On Mon, 24 Jan 2005 11:45:34 -0500, Jeremy Bowers wrote:

> On Mon, 24 Jan 2005 15:35:11 -0600, Philippe C. Martin wrote:
> 
>> The real reason behind my using private variables is so they do not appear
>> in the epydoc generated documentation and confuse my users.
> 
> You mean single or double underscores? I just checked and at least epydoc
> 2.1 doesn't include single-underscore values, but those aren't "private"
> in sense we're talking in this thread (some form of compiler enforcement).

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


  1   2   3   >