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...
 
 /F

-- 
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
 
 /F

-- 
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


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


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

2005-11-28 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-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


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 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


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


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


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


SnakeCard on sourceforge

2005-11-20 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
-- 
*
Philippe C. Martin
SnakeCard, LLC
www.snakecard.com
*
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


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


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 GPL products

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


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

I have released SnakeCard's produt line source code under the GPL licence
www.snakecard.com)

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)
School and Corporate IDs: Python (core), wxWidget (GUI), applets
BasicCard T=1, JavaCard T=0)


Regards,

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

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


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


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


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 URL: 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.
 
 mike

Thanks and regards,

Philippe



-- 
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


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 +, 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


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


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


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


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


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
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
http://www.w3.org/TR/html4/loose.dtd;\n
html\n
head\n
  titleAccess Granted/title\n
  meta name=GENERATOR content=Quanta Plus\n
  meta http-equiv=Content-Type content=text/html; charset=koi8-r\n
/head\n
body\n
H1Access Granted/H1\n
HR\n
H4Welcome %s /H4\n
HR\n
/body\n
/html\n


html_nok = 
Content-Type: text/html\n\n
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
http://www.w3.org/TR/html4/loose.dtd;
html

head
  titleAccess Granted/title
  meta name=GENERATOR content=Quanta Plus
  meta http-equiv=Content-Type content=text/html; charset=koi8-r
/head
body
H1Access Denied/H1
HR


/body
/html

# 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
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 http://www.w3.org/TR/html4/loose.dtd;\n
 html\n
 head\n
   titleAccess Granted/title\n
   meta name=GENERATOR content=Quanta Plus\n
   meta http-equiv=Content-Type content=text/html; charset=koi8-r\n
 /head\n
 body\n
 H1Access Granted/H1\n
 HR\n
 H4Welcome %s /H4\n
 HR\n
 /body\n
 /html\n
 
 
 html_nok = 
 Content-Type: text/html\n\n
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 http://www.w3.org/TR/html4/loose.dtd;
 html
 
 head
   titleAccess Granted/title
   meta name=GENERATOR content=Quanta Plus
   meta http-equiv=Content-Type content=text/html; charset=koi8-r
 /head
 body
 H1Access Denied/H1
 HR
 
 
 /body
 /html
 
 # 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
   html
   ...
   
 
 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
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 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


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

html
body
titleSmart Logon/title
h1Smart Logon/h1
hr
FORM METHOD=POST ACTION=/cgi-bin/scfbweb.py
table
TRTD
  INPUT TYPE=HIDDEN NAME=key VALUE=process
 TO SERVER:BR
  INPUT  type=text NAME=tosrv value=TO size=60
  BR
  FROM SERVERBR
  INPUT type=text name=fromsrv value=FROM size=60
  P 
INPUT TYPE=SUBMIT VALUE=START

/TD/TR/table
/FORM
/body
/html


-- 
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
 
 html
 body
 titleSmart Logon/title
 h1Smart Logon/h1
 hr
 FORM METHOD=POST ACTION=/cgi-bin/scfbweb.py
 table
 TRTD
   INPUT TYPE=HIDDEN NAME=key VALUE=process
  TO SERVER:BR
   INPUT  type=text NAME=tosrv value=TO size=60
   BR
   FROM SERVERBR
   INPUT type=text name=fromsrv value=FROM size=60
   P
 INPUT TYPE=SUBMIT VALUE=START
 
 /TD/TR/table
 /FORM
 /body
 /html

-- 
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
  html
  ^
 SyntaxError: invalid syntax
 
 D'oh! You needed to surround the html with quotes to make it a string, as
 in:
 
 print 
 html
 ...
 /html
 
 
 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?
 
   mike
 
 
 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
 
 html
 body
 titleSmart Logon/title
 h1Smart Logon/h1
 hr
 FORM METHOD=POST ACTION=/cgi-bin/scfbweb.py
 table
 TRTD
   INPUT TYPE=HIDDEN NAME=key VALUE=process
  TO SERVER:BR
   INPUT  type=text NAME=tosrv value=TO size=60
   BR
   FROM SERVERBR
   INPUT type=text name=fromsrv value=FROM size=60
   P
 INPUT TYPE=SUBMIT VALUE=START
 
 /TD/TR/table
 /FORM
 /body
 /html

 

-- 
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



 
 mike

-- 
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?
 
 mike

-- 
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.
 
  mike
But the plugin opened the connection: var l_w = window.open(l_url,);

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 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


   mike

-- 
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 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.
 
 I honestly don't know. HTTP does a strict onetime turnaround - the
 client sends, then the server sends, then you're done. There are hooks
 in the protocol to allow a connection to be resused, but that's a
 different request/response pair, and generally handled by the server,
 not the cgi script. After all, the next request from the client may be
 for some static file instead of the output of a cgi script.
 
 Having a cgi script start two

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


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


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: 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


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 protect Python source from modification

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

Why not just releasing the *.pyc ?

Regards,

Philippe




Frank Millman wrote:

 Hi all
 
 I am writing a multi-user accounting/business system. Data is stored in
 a database (PostgreSQL on Linux, SQL Server on Windows). I have written
 a Python program to run on the client, which uses wxPython as a gui,
 and connects to the database via TCP/IP.
 
 The client program contains all the authentication and business logic.
 It has dawned on me that anyone can bypass this by modifying the
 program. As it is written in Python, with source available, this would
 be quite easy. My target market extends well up into the mid-range, but
 I do not think that any CFO would contemplate using a program that is
 so open to manipulation.
 
 The only truly secure solution I can think of would involve a radical
 reorganisation of my program, so I am writing to see if anyone has a
 simpler suggestion. Here is the idea.
 
 1. Write a socket server program that runs on the server. The socket
 server is the only program that connects to the database. The client
 program connects to the server, which authenticates the client against
 the database and then listens for requests from the client.
 
 2. Devise my own protocol for communication between client and server.
 For selects, the client sends a request, the server checks permissions,
 then retrieves the data from the database and passes it to the client.
 For updates, the client passes up the data to be updated, the server
 checks it against its business logic, and then updates the database.
 
 There is the question of where state should be maintained. If on the
 server, I would have to keep all the client/server connections open,
 and maintain the state of all the sessions, which would put quite a
 load on the server. If on the client, I would have to reorganise my
 thinking even more, but this would have an advantage - I will
 eventually want to write a browser interface, and this would be much
 closer in concept, so the two approaches would be quite similar.
 
 This raises the question of whether I should even bother with a gui
 client, or bite the bullet and only have a browser based front end.
 Judging from recent comments about new technologies such as Ajax, a lot
 of the disadvantages have been overcome, so maybe this is the way to
 go.
 
 It would be a shame to scrap all the effort I have put into my
 wxPython-based front end. On the other hand, it would be pointless to
 continue with an approach that is never going to give me what I want.
 Any advice which helps to clarify my thinking will be much appreciated.
 
 Thanks
 
 Frank Millman

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


which reg values modified my python installer under windows

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

I am looking for the reg path that is modified/created by the pyton
installer to associate *.pyc with python.exe as I wish to associate *.pyc
with pythonw.exe

Regards,


Philippe

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


Re: which reg values modified my python installer under windows

2005-09-06 Thread Philippe C. Martin
Keir,

I forgot to mention that I want to do it automatically from my application's
installer.

Regards,

Philippe



keirr wrote:

 Philippe,
 
 You wrote:  I wish to associate *.pyc with pythonw.exe
 
   is there some reason why Tools-Folder Options-File Types (from a
 Windows Explorer menu) won't work?
 
 You could do it from a cmd prompt with assoc and ftype if you needed to
 script it.
 
 All the best,
 
  Keir.

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


Re: which reg values modified my python installer under windows

2005-09-06 Thread Philippe C. Martin
Yes Keir, Thanks a lot.

Regards;

Philippe



keirr wrote:

 Philippe,
 
 Windows file associations are in

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts
 
 Hope that helps you.
 
  All the best,
 
 Keir.

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


How to find Python path in Visual C++ install wizard

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

I realize this is not really a Python question but ...

I am trying to setup an .msi for my software (Python code (.pyc) + drivers)
to make installation easier for Windows users.

I am using the installer that comes with V. C++ 7.1.

I would like to find the way to make sure Python is installed and then copy
automatically my files into its hierarchy.


PS: for many reasons, I do not wish to use setup.py.

Best regards,

Philippe




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


Re: How to find Python path in Visual C++ install wizard

2005-08-13 Thread Philippe C. Martin
Thanks you all.


As my software has python executables and libraries + c++ libs, the
HKEY_LOCAL should be myt way out.

Best regards,

Philippe



Philippe C. Martin wrote:

 Hi,
 
 I realize this is not really a Python question but ...
 
 I am trying to setup an .msi for my software (Python code (.pyc) +
 drivers) to make installation easier for Windows users.
 
 I am using the installer that comes with V. C++ 7.1.
 
 I would like to find the way to make sure Python is installed and then
 copy automatically my files into its hierarchy.
 
 
 PS: for many reasons, I do not wish to use setup.py.
 
 Best regards,
 
 Philippe

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


SCF 1.2b1 released

2005-07-22 Thread Philippe C. Martin

I am very please to announce the release of SCF 1.2b1 a Smart Card
development system designed in Python:

Two major features are being introduced: 

1) Support for BasicCard DES/3/DES/AES secure messaging (Beta release 1) .

2) COM Support: access the power of SCF from Visual Basic or your favorite
Windows® language! SCF COM extension is provided as source code so
extensions can be applied by the programers.


SCF is available on www.snakecard.com for download and free testing. 
You may also browse the reference guide online.


Best regards,


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

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


Re: returning list of strings from Python COM to Visual basic 6

2005-07-21 Thread Philippe C. Martin
Thanks a bunch,

I'll try this, This raises two questions:
1) How do I declare the receiving VB variable ?
2) Then, can I use the returned object as a COM object: call its public 
methods (that would be hot)?


Dim newobj as ?
newobj = acom.Get_Obj()

newobj.A_Public()


Regards,

Philippe





On Thursday 21 July 2005 09:55 am, Stefan Schukat wrote:
 You have to wrap the python object with a COM object:

 def Get_Obj(self):
   return win32com.server.util.wrap(an_object)


   Stefan

  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] Behalf Of
  Philippe C. Martin
  Sent: Thursday, July 21, 2005 1:42 AM
  To: python-list@python.org
  Subject: Re: returning list of strings from Python COM to
  Visual basic 6
 
 
  I can now pass and return quite a few types except object
  instances: my
  python code gets to the point where I do:
 
 
  def Get_Obj(self):
  .
  return an_object
 
  My VB code looks like
 
  Dim obj as Variant
 
  obj = acom.Get_Obj()
 
 
  I get an unexpected Python error . Objects of type
  'instance' can not
  be converted to a COM VARIANT
 
  Is there a way out ?
 
  Thanks,
 
  Philippe
 
  Philippe C. Martin wrote:
   Hi,
  
   Is it possible ?
  
   ex: return ['1','2']
  
   If so which type should I use in VB ?
  
   dim res as ???
  
   Set testObj = CreateObject()
  
   res = testObj.AMethodThatReturnsAListOfStrings()
  
  
   Thanks,
  
   Philippe
 
  --
  http://mail.python.org/mailman/listinfo/python-list

 The Leading Manufacturing Test Company of the Year 2005
 http://www.dspace.de/goto?f_s_award

-- 
*
Philippe C. Martin
SnakeCard, LLC
www.snakecard.com
+1 405 694 8098
*
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: returning list of strings from Python COM to Visual basic 6

2005-07-21 Thread Philippe C. Martin
I guess that also means (which makes sense) that the returned object has to
be registered as a COM object.

However, in my case, I just needed that object to pass it to yet another
object, I did not need to use it from VB

Regards,

Philippe



Philippe C. Martin wrote:

 Thanks a bunch,
 
 I'll try this, This raises two questions:
 1) How do I declare the receiving VB variable ?
 2) Then, can I use the returned object as a COM object: call its public
 methods (that would be hot)?
 
 
 Dim newobj as ?
 newobj = acom.Get_Obj()
 
 newobj.A_Public()
 
 
 Regards,
 
 Philippe
 
 
 
 
 
 On Thursday 21 July 2005 09:55 am, Stefan Schukat wrote:
 You have to wrap the python object with a COM object:

 def Get_Obj(self):
 return win32com.server.util.wrap(an_object)


 Stefan

  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] Behalf Of
  Philippe C. Martin
  Sent: Thursday, July 21, 2005 1:42 AM
  To: python-list@python.org
  Subject: Re: returning list of strings from Python COM to
  Visual basic 6
 
 
  I can now pass and return quite a few types except object
  instances: my
  python code gets to the point where I do:
 
 
  def Get_Obj(self):
  .
  return an_object
 
  My VB code looks like
 
  Dim obj as Variant
 
  obj = acom.Get_Obj()
 
 
  I get an unexpected Python error . Objects of type
  'instance' can not
  be converted to a COM VARIANT
 
  Is there a way out ?
 
  Thanks,
 
  Philippe
 
  Philippe C. Martin wrote:
   Hi,
  
   Is it possible ?
  
   ex: return ['1','2']
  
   If so which type should I use in VB ?
  
   dim res as ???
  
   Set testObj = CreateObject()
  
   res = testObj.AMethodThatReturnsAListOfStrings()
  
  
   Thanks,
  
   Philippe
 
  --
  http://mail.python.org/mailman/listinfo/python-list

 The Leading Manufacturing Test Company of the Year 2005
 http://www.dspace.de/goto?f_s_award
 

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


returning list of strings from Python COM to Visual basic 6

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

Is it possible ?

ex: return ['1','2']

If so which type should I use in VB ?

dim res as ???

Set testObj = CreateObject()

res = testObj.AMethodThatReturnsAListOfStrings()


Thanks,

Philippe

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


Re: returning list of strings from Python COM to Visual basic 6

2005-07-20 Thread Philippe C. Martin
Sorry, it was in the book: Variant !

Regards;

Philippe



Philippe C. Martin wrote:

 Hi,
 
 Is it possible ?
 
 ex: return ['1','2']
 
 If so which type should I use in VB ?
 
 dim res as ???
 
 Set testObj = CreateObject()
 
 res = testObj.AMethodThatReturnsAListOfStrings()
 
 
 Thanks,
 
 Philippe

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


Re: returning list of strings from Python COM to Visual basic 6

2005-07-20 Thread Philippe C. Martin
I can now pass and return quite a few types except object instances: my
python code gets to the point where I do:


def Get_Obj(self):
.
return an_object

My VB code looks like

Dim obj as Variant

obj = acom.Get_Obj()


I get an unexpected Python error . Objects of type 'instance' can not
be converted to a COM VARIANT

Is there a way out ?

Thanks,

Philippe






Philippe C. Martin wrote:

 Hi,
 
 Is it possible ?
 
 ex: return ['1','2']
 
 If so which type should I use in VB ?
 
 dim res as ???
 
 Set testObj = CreateObject()
 
 res = testObj.AMethodThatReturnsAListOfStrings()
 
 
 Thanks,
 
 Philippe

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


Re: What is your favorite Python web framework?

2005-07-17 Thread Philippe C. Martin

http://cheetahtemplate.org/



Admin wrote:

 On Sun, 17 Jul 2005 19:15:49 -0300, Sybren Stuvel
 [EMAIL PROTECTED] wrote:
 
 http://www.unrealtower.org/mycheetah
 
 Error 404 while looking up your page AND when looking for a suitable 404
 page. Sorry!
 No such file /var/www/www.unrealtower.org/compiled/error404.py
 
 I can't express myself on Cheetah, sorry!!
 

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


pywin32 com server cash question

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

I just got the pywin32 hello world COM server to install and I did manage
to use it from VB 6.0.

However, there are some glitches I do not comprehend:

1) at one point I got a python runtime error telling me the testcomserver
was not found - I got rid of that problem by deleteting the appropriate (I
hope) registry and reregistering the server

2) If I change the source of the server 
from:
return Hello + 
to:
return Hello my friend  + 


I still get Hello BINGO only in my VB message box. this even if I try to
re-register (which does not seem necessary) the server.


Q.1) What could that error have meant ?
Q.2) is there a way to flush whatever so my new code Hello my friend
shows up ?




The VB looks like this:

Private Sub Command1_Click()
  Dim shdemo = CreateObject(Python.TestServer)
  MsgBox (shdemo.Hello(BINGO))
End Sub

The Python server :

class HelloWorld:

_reg_clsid_ = {7CC9F362-486D-11D1-BB48-E838A65F}
_reg_desc_ = Python Test COM Server
_reg_progid_ = Python.TestServer
_public_methods_ = ['Hello']
_public_attrs_ = ['softspace', 'noCalls']
_readonly_attrs_ = ['noCalls']
#_reg_class_spec_ = testcomserver.HelloWorld

def __init__(self):

self.softspace = 1

self.noCalls = 0

def Hello(self, who):

self.noCalls = self.noCalls + 1

# insert softspace number of spaces

return Hello My Friend  +   * self.softspace + str(who)

if __name__=='__main__':
# ni only for 1.4!
import  win32com.server.register 
win32com.server.register.UseCommandLine(HelloWorld)
import pythoncom
print pythoncom.CreateGuid()



Regards,

Philippe







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


Re: pywin32 com server cash question

2005-07-12 Thread Philippe C. Martin
Sorry: Cache, not Cash



Philippe C. Martin wrote:

 Hi,
 
 I just got the pywin32 hello world COM server to install and I did
 manage to use it from VB 6.0.
 
 However, there are some glitches I do not comprehend:
 
 1) at one point I got a python runtime error telling me the
 testcomserver was not found - I got rid of that problem by deleteting
 the appropriate (I hope) registry and reregistering the server
 
 2) If I change the source of the server
 from:
 return Hello + 
 to:
 return Hello my friend  + 
 
 
 I still get Hello BINGO only in my VB message box. this even if I try to
 re-register (which does not seem necessary) the server.
 
 
 Q.1) What could that error have meant ?
 Q.2) is there a way to flush whatever so my new code Hello my friend
 shows up ?
 
 
 
 
 The VB looks like this:
 
 Private Sub Command1_Click()
   Dim shdemo = CreateObject(Python.TestServer)
   MsgBox (shdemo.Hello(BINGO))
 End Sub
 
 The Python server :
 
 class HelloWorld:
 
 _reg_clsid_ = {7CC9F362-486D-11D1-BB48-E838A65F}
 _reg_desc_ = Python Test COM Server
 _reg_progid_ = Python.TestServer
 _public_methods_ = ['Hello']
 _public_attrs_ = ['softspace', 'noCalls']
 _readonly_attrs_ = ['noCalls']
 #_reg_class_spec_ = testcomserver.HelloWorld
 
 def __init__(self):
 
 self.softspace = 1
 
 self.noCalls = 0
 
 def Hello(self, who):
 
 self.noCalls = self.noCalls + 1
 
 # insert softspace number of spaces
 
 return Hello My Friend  +   * self.softspace + str(who)
 
 if __name__=='__main__':
 # ni only for 1.4!
 import  win32com.server.register
 win32com.server.register.UseCommandLine(HelloWorld)
 import pythoncom
 print pythoncom.CreateGuid()
 
 
 
 Regards,
 
 Philippe

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


Re: Options to integrate Python modules into native windows applications

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

Thanks for your answers,

has anyone also used .net for Python ?

Regards,

Philipe



Philippe C. Martin wrote:

 Hi,
 
 I am looking for the pros and cons as to how to integrate a Python module
 into a Windows native application.
 
 So far I have looked at
 
 1) coding the C wrapper myself
 2) using Pyrex
 3) go for pywin32 and COM
 
 Thanks,
 
 Philippe

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


Options to integrate Python modules into native windows applications

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

I am looking for the pros and cons as to how to integrate a Python module
into a Windows native application.

So far I have looked at

1) coding the C wrapper myself
2) using Pyrex
3) go for pywin32 and COM

Thanks,

Philippe


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


Re: Options to integrate Python modules into native windows applications

2005-07-07 Thread Philippe C. Martin
Thanks Larry,

I want to:

1) Modify my code as little as possible
2) Please/reassure the lambda VB or VC++ oriented company

Regards,

Philippe



Larry Bates wrote:

 Other methods (services, sockets, pipes, etc.)
 can also work well, but it depends on what you
 want to do and how you wish to communicate between
 the modules.

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


RE: Thoughts on Guido's ITC audio interview

2005-07-07 Thread Philippe C. Martin
 For me, performance is the minor issue. Usability is the major issue. If
 find Eclipse to be highly unusable, so I don't use it.

I find it to be the best option out there

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


Re: adding a character to the last string element of a list

2005-07-06 Thread Philippe C. Martin
Thanks,

Philippe


Peter Hansen wrote:

 Philippe C. Martin wrote:
 I guess my slicing was wrong, l[-1] worked
 
 Note that that's _not_ a slice, however, but a reference to the last
 element in the list.
 
 You'd have to subclass list to be able to do something with
 reference-slices.  Probably returning a special object from
 __getslice__ which itself has references back to the original list and
 implements any changes back in the original instead of in itself.  I
 haven't tried to imagine if this is even feasible.
 
 Anything indexing with : in it is a slice, so a copy, while anything
 with only a single index as you have in l[-1] is just a reference to one
 element in the list.
 
 -Peter

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


Re: I am a Java Programmer

2005-07-06 Thread Philippe C. Martin
I see you got many good/funny answers already.

Test Python for two WE and you'll be able to help yourself very well ...
I've been through an equivalent process.

Regards,

Philippe




[EMAIL PROTECTED] wrote:

 I am a java programmer and I want to learn Python Please help me.

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


Re: Lisp development with macros faster than Python development?..

2005-07-06 Thread Philippe C. Martin


Almost sounds like a racist comment - sorry if I misunderstood


Antoon Pardon wrote:

 Op 2005-07-06, Michele Simionato schreef [EMAIL PROTECTED]:
 Fuzzyman:
 So Lisp is for really good programmers, and Python is for
 mediocre programmers ?


 Python is *also* for mediocre programmers. I see this as a
 strength, not as a weakness.
 
 But sometimes I get the impression people want it to evolve
 so it is only for mediocre programmers.
 

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


Re: How to display Values of a file

2005-07-05 Thread Philippe C. Martin
I think you'll have to go through extensions:
http://starship.python.net/crew/mhammond/

Regards,

Philippe




Kakushi wrote:

 Hi my name is Andrew beginning/intermediate Python User. I am using a
 win xp computer Python 2.4
 
 I would like to write a python application that would allow me to view
 paths of all installed files and registry values associated with that
 file for example I enter the file C:\WINDOWS\iexplorer.exe and it gives
 me reg value 1, reg value 2, folder 1, folder 2.
 
 This will eventually lead into running an application installer, for
 example C:\setup.exe and running through the processes of the install
 displaying a listing of all associated files with that install through
 my application
 
 Is this something that is possible with Python if so what modules should
 I look into If so has anyone done anything similiar
 
 if not I guess I will have to look into different ideas

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


adding a character to the last string element of a list

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

I have the following question:

l = ['ABCDE','FGHI']
l[1:] #returns ['FGHI']
l[1:][0] #return 'FGHI'

a = l[1:][0] + 'J' #a becomes 'FGHIJ'

l[1:][0] += 'J' #NO ERROR BUT l[1:][0] == 'FGHI'


What am I missing ?

Thanks,

Philippe




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


RE: adding a character to the last string element of a list

2005-07-05 Thread Philippe C. Martin
I guess my slicing was wrong, l[-1] worked

Regards,

Philippe

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


Re:

2005-07-01 Thread Philippe C. Martin
Being a C programmer before a C++  I am not certain my opinon qualifies.

Yet I have seen myself avoiding C++ contracts lately because I dread going
back to that type of work: why use silex when you got a match ?




Adriaan Renting wrote:

 I'm not a very experienced Python programmer yet, so I might be
 mistaken, but there are a few things that would make me prefer C++ over
 Python for large (over 500.000 LOC) projects.
 - namespaces
 - templates
 - strong type checking
 - data hiding
 - more available libraries and more advanced developement tools.
 
 I'm talking about managing the code, not the programmers, the project or
 schedules or what have you. Those are independent from the chosen
 programming language.

http://www.compusa.com/products/product_info.asp?product_code=301605pfp=cat3
 Ultimately, manageability of a project is far and away more about the
 people involved and the techniques used than it is about any single
 technology involved.
 
 Agreed.
 
 Adriaan Renting| Email: [EMAIL PROTECTED]
 ASTRON | Phone: +31 521 595 217
 P.O. Box 2 | GSM:   +31 6 24 25 17 28
 NL-7990 AA Dwingeloo   | FAX:   +31 521 597 332
 The Netherlands| Web: http://www.astron.nl/~renting/
 [EMAIL PROTECTED] 06/30/05 4:15 PM

 Peter Hansen [EMAIL PROTECTED] writes:
 
 Harry George wrote:
  Adriaan Renting [EMAIL PROTECTED] writes:
 Both VB and Python are easier to learn as the more powerful
 languages, the price is that they lack features that make it easier
 to
 manage large and complex projects.
  What is a large project, and what is Python missing that C++ and
 Java
  have for such tasks?
 
 But C++ and Java have features that *management* likes, thus making it
 easier to manage large projects.  (That says nothing about whether
 or not it makes it easier to produce quality code, successful
 projects, happy customers, large profits, or any such silly
 things... just that it's easier to manage. ;-)
 
 Less facetiously: I have managed a large Python project or three, and
 several large C++ projects (and, thankfully, no large Java projects)
 and found Python quite up to the task.  In fact, if anything the C++
 projects ended up more in danger of succumbing to the sheer weight of
 the code than did the Python projects.  But I attribute this more to
 the fact that we had evolved to using agile approaches with the Python
 projects than to any of those special features either present or
 lacking in C++.
 
 Ultimately, manageability of a project is far and away more about the
 people involved and the techniques used than it is about any single
 technology involved.
 
 -Peter
 
 That's our experience too (and the reason I asked).  I wonder if the
 OP will respond.
 
 

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


Re: Seeking IDE

2005-06-30 Thread Philippe C. Martin
Linux: Eric3
All: Eclipe: my choice (might be tough to get into)



Nick Mountford wrote:

 Hi,
 
 Complete newb to Python and programming, looking for an open source
 IDE to download. Any suggestions?
 
 Thanks,
 
 Nick

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


Re: Seeking IDE

2005-06-30 Thread Philippe C. Martin
oops: eclipse

Philippe C. Martin wrote:

 Linux: Eric3
 All: Eclipe: my choice (might be tough to get into)
 
 
 
 Nick Mountford wrote:
 
 Hi,
 
 Complete newb to Python and programming, looking for an open source
 IDE to download. Any suggestions?
 
 Thanks,
 
 Nick

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


Re: ANN: PyDev 0.9.5 released

2005-06-28 Thread Philippe C. Martin
Thanks Fabio,

I take this opportunity to ask what I could be doing wrong with pylint: my
PYTHONPATH is good (I think), my code compiles and passes pylint when I run
it by hand. Yet pylint in pydev does not seem to think the modules I
include and usually derive from exist.

Any clue ?

Regards,

Philippe


Fabio Zadrozny wrote:

 Hi All,
 
 PyDev - Python IDE (Python Development Enviroment for Eclipse) version
 0.9.5 has just been released.
 
 Check the homepage (http://pydev.sourceforge.net/) for more details.
 
 Release Highlights:
 
 - File encodings now follow the python convention
 - Overview ruler now works
 - Editor is synchronized when working in multiple windows with the same
 file - Code folding improved
 - Syntax highlighting is not confused by escaped quote + triple quote
 anymore
 - Insertion of parentheses now replaces selected text
 - Some more bugs...
 
 Regards,
 

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


  1   2   3   >