[python-win32] PyTime

2007-05-08 Thread Francesco Guerrieri
hello, I have another newbie question. I have googled around but didn't find an answer. I have an Excel file with many dates beyond 2038, which arrive to me as a list of PyTime objects. From the doc I have found ( http://aspn.activestate.com/ASPN/docs/ActivePython/2.4/pywin32/PyTime.html ) it app

Re: [python-win32] PyTime

2007-05-08 Thread Mark Mc Mahon
Hi, Maybe there is a better way then this suggestion... from datetime import datetime date = day = int(xl.activecell.value.Format("%d")) month = int(xl.activecell.value.Format("%m")) year = int(xl.activecell.value.Format("%Y")) date_as_datetime = datetime(year, month, day) PyTime is starting

Re: [python-win32] PyTime

2007-05-08 Thread Tim Golden
Mark Mc Mahon wrote: > Hi, > > Maybe there is a better way then this suggestion... > > from datetime import datetime > > date = > > day = int(xl.activecell.value.Format("%d")) > month = int(xl.activecell.value.Format("%m")) > year = int(xl.activecell.value.Format("%Y")) > > date_as_datetime =

Re: [python-win32] PyTime

2007-05-08 Thread Francesco Guerrieri
thanks :) I resorted to your solution: for i in DataList: OutputList.append(datetime.date(int(i.Format("%Y")), int(i.Format("%m")), int(i.Format("%d" return OutputList and it works. I am considering dates up to 50 years from now so 2038 is definitely too early :-) Francesco On 5/

Re: [python-win32] PyTime

2007-05-08 Thread Mark Hammond
> I have an Excel file with many dates beyond 2038, which arrive to me as a list of PyTime objects. > From the doc I have found ( http://aspn.activestate.com/ASPN/docs/ActivePython/2.4/pywin32/PyTime.html ) > it appears that an int conversion is needed to handle them. To answer Mark's question fir

Re: [python-win32] PyTime

2007-05-08 Thread Francesco Guerrieri
On 5/8/07, Mark Hammond <[EMAIL PROTECTED]> wrote: Your solution seems to be to simply construct a datetime object from the pywintypes time object by way of attributes - eg: >>> from win32com.client import Dispatch >>> import datetime >>> xl=Dispatch("Excel.Application") >>> d=xl.Range("A1").Va

Re: [python-win32] PyTime

2007-05-08 Thread Tim Golden
> the docs didn't explicitly cite the existance of those attributes... Well in fact they do (at least my version of the .chm does) and to my shame I hadn't looked there, relying on a quick dir (), which only shows the .Format method. > Now the code is much more readable :-) Indeed. TJG ___

[python-win32] py2exe - ms vista - CreateProcess/ShellExecute/etc...

2007-05-08 Thread InNomine
Hi, after hours of searching, testing and hoping to code for vista never again ;) i tried to call an application with everything i found... sometimes py2exe couldn't load the needed modules. but every time the app stuck. it seems that ShellExecuteEx doesnt word with py2exe... maybe i'm wrong. i r

Re: [python-win32] PyTime

2007-05-08 Thread Robert Brewer
Mark Hammond wrote: > Your solution seems to be to simply construct a datetime > object from the > pywintypes time object by way of attributes - eg: > > >>> from win32com.client import Dispatch > >>> import datetime > >>> xl=Dispatch("Excel.Application") > >>> d=xl.Range("A1").Value > >>> datetim

Re: [python-win32] Fw: Python COM and Photoshop

2007-05-08 Thread Sam The Cat
Mark, My apologies -- I tried to relay that I have tried both ways -- "early and late dispatch" Here is the output after running the makepy routine on the type and object libraries for Photoshop --- 2.5.1 (r251:548

Re: [python-win32] Fw: Python COM and Photoshop

2007-05-08 Thread Sam The Cat
As a follow-up question is there a way to see what python thinks the variable should be ? In looking at the file created by makepy I see the function call for select but nothing that looks to me like information relating to the type of variable that needs to be generated here is the method in

[python-win32] how to create a valid Sink

2007-05-08 Thread Christian K.
Hi, I'd like to ask for help on how to create a valid event Sink which I can pass to the Advise() method of a message stores table. Any class I made up so far gives the same error: File "", line 333, in notify TypeError: The Python instance can not be converted to a COM object So what attribu