Re: How to pass variable to test class

2006-04-20 Thread Podi
Thanks for replying. I need to pass some external values to the test cases because I want to run the same tests in different environments such as lab/instrument setup. Regards, Podi -- http://mail.python.org/mailman/listinfo/python-list

Do anyone already have code to copy nested files to a flat directory?

2006-03-20 Thread Podi
Hi, I am trying to copy all files under a directory tree to a single directory (in Windows). I can well write the script myself, but was wonder if anyone has done it so I won't be reinventing the wheel. Thanks in advance. Requirement: # Source file set source\file1.txt source\file2.doc source\d

Re: Do anyone already have code to copy nested files to a flat directory?

2006-03-20 Thread Podi
OK, please don't bother. Here is my wheel :-) import os import shutil def CopyFlat(source, target): count = 0 for root, dirs, files in os.walk(source): for file in files: count += 1 name = root + '\\' + file print '%04d Copying' % count, name,

Re: Do anyone already have code to copy nested files to a flat directory?

2006-03-20 Thread Podi
Thanks for all the suggestions. Now the wheel comes with bells and whistles ;) -- http://mail.python.org/mailman/listinfo/python-list

How to call functions in Advapi32.dll using ctypes

2006-04-07 Thread Podi
I have ctypes version 0.9.6 and Python 2.4.2 running on Windows XP Professional. When I tried to use some functions in the Advapi32.dll, some functions are available and some are not. Is this a bug or feature by design? In the example below, I am trying to examine the 'InitiateSystemShutdown' fun

Re: Programming Tutorial for absolute beginners

2006-04-07 Thread Podi
For tutorial in Windows, I think it is better to use the more user-friendly interpreter from http://activestate.com/store/languages/register.plex?id=ActivePython. Advise the user to just click on the "Next" button without submitting the optional contact information. My $0.02 -- http://mail.pytho

Re: How to call functions in Advapi32.dll using ctypes

2006-04-10 Thread Podi
> Have you tried calling InitiateSystemShutdownA mentioned in the > documentation? Thanks! This function exists. However, advapi32.InitiateSystemShutdownA("", 'This is a test', 30, 1, 1) returns 0 though. I will need to play with it a bit more... -- http://mail.python.org/mailman/listinfo/python

How to create a single executable console application?

2006-04-10 Thread Podi
I followed the instructions from http://starship.python.net/crew/theller/moin.cgi/SingleFileExecutable Copied the second setup.nsi, setup.py, single.py and everything works like a champ. I then replaced "single.exe" by "hello.exe" in setup.nsi. Created hello.py as follows: #! python def main():

Re: How to create a single executable console application?

2006-04-13 Thread Podi
Alright, pythoneers, here is what I have found from http://wiki.wxpython.org/index.cgi/CreatingStandaloneExecutables. This is much easier than the py2exe + nullsoft combo :) Cheers! The mcillian installer development is discontinued. mirror: http://davidf.sjsoft.com/mirrors/mcmillan-inc/installe

Re: How to create a single executable console application?

2006-04-13 Thread Podi
Alright, pythoneers, here is what I have found from http://wiki.wxpython.org/index.cgi/CreatingStandaloneExecutables. This is much easier than the py2exe + nullsoft combo :) Cheers! The mcillian installer development is discontinued. mirror: http://davidf.sjsoft.com/mirrors/mcmillan-inc/installe

How to pass variable to test class

2006-04-16 Thread Podi
Hi, Newbie question about unittest. I am having trouble passing a variable to a test class object. MyCase class will potentially have many test functions. Any help would be much appreciated. Thanks, P # File MyCase.py import unittest class MyCase(unittest.TestCase): def __init__(self, val

ctypes pointer to pointer

2006-09-27 Thread Podi
Hi, I have a C function in the dll does the following: DLL_API int dll_foo(char **data, size_t *size) { strcpy(*data, "hello"); *size = strlen(*data); return 0; } So I would call the function as such, char data[8]; size_t size; int status = dll_foo(&data, &size); I have tried th

Re: ctypes pointer to pointer

2006-09-28 Thread Podi
Thanks for the help. I've figured it out. BTW, DLL_API is defined as #ifdef MYDLL_EXPORTS #define DLL_API __declspec(dllexport) #else #define DLL_API __declspec(dllimport) #endif size = c_int() data = c_char_p('\0' * 8) mydll = cdll.mydll # Use cdll instead of windll to avoid warnings status = m

Excel file read/write?

2006-11-09 Thread Podi
As far as I know, there is pyXLWriter for writing and xlrd for reading. Is there such thing so that one can open an Excel file into memory and read/update any sheet/cell on the fly. One analogy to this is the ConfigParser module. Any info would be much appreciated. -- http://mail.python.org/mail

Re: Excel file read/write?

2006-11-09 Thread Podi
Thanks for the reply. > > Most folk would seem to be using pyExcelerator rather than pyXLWriter. > It is much more up to date, it just hasn't been worked on for a year, I will give it a shot. > 1. Python COM interface (part of > http://sourceforge.net/projects/pywin32/) with lots of users (and h

Re: urllib en https

2006-11-09 Thread Podi
> > As I recall, ActiveState doesn't distribute the SSL package that the > > python.org package contains. But... It is possible to copy the SSL > > related files from a python.org package into the ActiveState > > installation. > Are there any instructions on doing this? My Python installation

windows background process

2006-11-22 Thread Podi
Hi, I am using Python 2.4.4 on Windows XP SP2. I am trying to start a process (infinite loop application) in the background and I've tried several options and none of them seem to work. Any help would be much appreciated. Thanks, P 1. # This works on PythonWin interactive window, but the pytho

Re: windows background process

2006-11-22 Thread Podi
Some update... I just found out that the following seems to work, import subprocess subprocess.Popen(' myargs', executable='mycmd.exe') However, it does not work with "my path\\mycmd.exe" subprocess.Popen(' myargs', executable='"my path\\mycmd.exe"') # error -- http://mail.python.org/mailman/

Re: windows background process

2006-11-27 Thread Podi
Gabriel Genellina wrote: > os.spawnl(os.P_NOWAIT, 'mycmd.exe', 'mycmd.exe', 'first_arg', 'second_arg') > That is, you must provide explicitely the value for argv[0] (executable) > Remember to quote appropiately any parameter with embedded spaces > (including the executable). On Python 2.5 you coul

Windows SetLocalTime

2006-12-13 Thread Podi
I am trying to set the system time on my Windows computer, but avoid using the DOS command (date, time). Does anyone know what parameter to pass to function SetLocalTime? CSharp ref http://groups.google.com/group/microsoft.public.dotnet.languages.csharp/browse_thread/thread/813b4ef504f77a43/24fc3

Re: Windows SetLocalTime

2006-12-13 Thread Podi
Yes, thank you. I found the function SetLocalTime or SetSystemTime to set the time from MSDN http://msdn2.microsoft.com/en-us/library/ms724942.aspx. I am having trouble passing parameter to the functions in Python. Rob Williscroft wrote: > > Google will usually find the documentation of anything

Re: Windows SetLocalTime

2006-12-13 Thread Podi
Thank you. It works :-) P Rob Williscroft wrote: > Ok I see, you will probably need these 2 bits of the ctypes > documentation: > > http://docs.python.org/lib/ctypes-structures-unions.html > http://docs.python.org/lib/ctypes-pointers.html > > From there on geting to this is farly straight fo

Re: array of class

2007-01-02 Thread Podi
> > Or more compactly: > > > > words = [Word(w) for w in 'this is probably what you want'.split()] > > print words > > I didn't want to introduce yet some more "confusing" stuff !-) Indeed, the for loop is perfectly fine and totally readable. Let's save the "confusing stuff" to the Perl folks. -