[python-win32] python 3 support

2012-02-01 Thread Roman Morawek
Hello,

I am just starting a new activity where I need to intact with MS
Project. Since this is a new topic, I intend to start using Python 3.2.
However, as I understand I need to use the pywin32 package, which is not
supporting Python 3.

Is this assumption correct?

Is there any alternativ package available, which allows me to
import/export MS project files?

Is there a plan to support Python 3 in pywin32 in future?

Thanks a lot for your feedback,
Roman Morawek
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] python 3 support

2012-02-01 Thread Tim Roberts
Roman Morawek wrote:
> I am just starting a new activity where I need to intact with MS
> Project. Since this is a new topic, I intend to start using Python 3.2.

In my opinion -- and it is ONLY my opinion -- the smartest place to
begin a new project today is with Python 2.7.  The third-party library
support is still too spotty in Python 3.  It's getting there, but it's
not there yet.  (It is actually taking longer than I expected.)
 
> Is there any alternativ package available, which allows me to
> import/export MS project files?

Remember that Python doesn't know anything about Project.  You will be
interactive with the Project application as a COM server.  Python (with
PyWin32) understands how to communicate with COM servers, but you won't
find anything specific about Python and Project.  You will need to
translate the Project object model documentation from C++ or C# to Python.

It's usually not that hard.  There are LOTS of examples of controlling
Word and Excel from Python, and the concepts are very similar.

-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] python 3 support

2012-02-01 Thread Brian Curtin
On Wed, Feb 1, 2012 at 13:56, Roman Morawek  wrote:
> Hello,
>
> I am just starting a new activity where I need to intact with MS
> Project. Since this is a new topic, I intend to start using Python 3.2.
> However, as I understand I need to use the pywin32 package, which is not
> supporting Python 3.

It has supported Python 3 since at least 2009.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] python 3 support

2012-02-01 Thread Roman Morawek
On 01.02.2012 21:51, Brian Curtin wrote:
> It has supported Python 3 since at least 2009.

Interesting. It seems I just got confused by the list of the 25 most
often nominated packages where users desire Python 3 support:
http://python.org/3kpoll

There is a hint on how to unlist the package there. The package author
may want to do this.

Best regards,
Roman
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] python 3 support

2012-02-01 Thread Dietmar Schwertberger

Am 01.02.2012 20:56, schrieb Roman Morawek:

Is there any alternativ package available, which allows me to
import/export MS project files?


MS Project can write and read XML files.
Maybe that's good enough for you. Just save a project as XML and have
a look. The structure is not too complicated. Much easier to use than
e.g. XML files from Word or Excel.



Regards,

Dietmar

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] problem AddLine AutoCAD win32com.client

2012-02-01 Thread Mark Hammond

Re-added the python-win32 list - please keep replies on list.

Your code uses:

> pt1 = array.array('d', [0.0,0.0,0.0])
> pt2=array.array('d',[1.0,1.0,__0.0])

But these aren't supported by pywin32 in the way you expect - what 
happens if you change this to:


 pt1 = [0.0,0.0,0.0]
 pt2 =[1.0,1.0,0.0]

?

Mark


On 2/02/2012 7:12 AM, DANIEL POSE wrote:

Hello Mark,

I understand the AutoCAD problem, but in my profession it is the most
extended software for CAD. In my opinion it justify the efford to make
automation tools.
Here I post the answer from Python when I try to draw a line using
win32com.client code in my last mail:

Traceback (most recent call last):
   File "", line 1, in 
   File
"C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\startup.py",
line 128, in runfile
 execfile(filename, glbs)
   File "C:\Documents and Settings\Usuario\Escritorio\borrar.py", line
15, in 
 line = ms.AddLine(pt1, pt2) #This draw a line in AutoCAD
   File ">", line 3, in AddLine
com_error: (-2147352567, 'Ocurri\xf3 una excepci\xf3n.', (0, None, None,
None, 0, -2147024809), None)

Thank you in advance,
Daniel Pose.

2012/2/1 Mark Hammond mailto:skippy.hamm...@gmail.com>>

Sadly not many people have access to autocad so it is hard to test.
What errors do you get using win32com?

Mark


On 1/02/2012 5:11 AM, DANIEL POSE wrote:

Hello,

Recently I try to write some code to automate AutoCAD from Python. I
have to draw lines from Python using win32com.client module, but I
obtain error. By other hand I solved the problem using comtypes
module.
However, If I try to obtain block attributes information, comtypes
doesn't work but win32com.client work properly.

AutoCAD attributes working code (work for win32com.client but no for
comtypes):
[code]
import win32com.client
acad= win32com.client.Dispatch("__AutoCAD.Application")
doc = acad.ActiveDocument
seleccion=doc.SelectionSets.__Add('selection1')
seleccion.SelectOnScreen()
for objeto in seleccion:
 if objeto.ObjectName=='__AcDbBlockReference':
 bloque=objeto.GetAttributes()
 bloque[0].TagString='__newattributename' #This change
the name
for the first attribute in the selected block
[/code]

Draw line (work for comtypes but doesn't work for win32com.client):
[code]
import comtypes.client
import array
acad = comtypes.client.__GetActiveObject("AutoCAD.__Application")
doc = acad.ActiveDocument
ms = doc.ModelSpace
pt1 = array.array('d', [0.0,0.0,0.0])
pt2=array.array('d',[1.0,1.0,__0.0])
line = ms.AddLine(pt1, pt2) #This draw a line in AutoCAD
[\code]

My question is: Is posible to fix the problem using win32com to draw
autocad line in order to avoid comtypes use?
I found on the web several coments to the problem, but no solution.

Thanks for help,
Daniel Pose.


_
python-win32 mailing list
python-win32@python.org 
http://mail.python.org/__mailman/listinfo/python-win32






___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] problem AddLine AutoCAD win32com.client

2012-02-01 Thread DANIEL POSE
I have used array module because it worked with comtypes module. If I use
simple list it doesn't work with comtypes nor pywin32.
If I use:
pt1 = [0.0,0.0,0.0]
pt2 =[1.0,1.0,0.0]

Then Python responds:


Traceback (most recent call last):
  File "", line 1, in 
  File
"C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\startup.py",
line 128, in runfile
execfile(filename, glbs)
  File "C:\Documents and Settings\Administrador\Mis
documentos\DropboxDani\Dropbox\PYTHON\PruebaAutoCADLinea.py", line 16, in

line = ms.AddLine(pt1, pt2)
  File ">", line 3, in AddLine
com_error: (-2147352567, 'Ocurri\xf3 una excepci\xf3n.', (0, None, None,
None, 0, -2147024809), None)



2012/2/1 Mark Hammond 

> Re-added the python-win32 list - please keep replies on list.
>
> Your code uses:
>
>
> > pt1 = array.array('d', [0.0,0.0,0.0])
> > pt2=array.array('d',[1.0,1.0,_**_0.0])
>
> But these aren't supported by pywin32 in the way you expect - what happens
> if you change this to:
>
> pt1 = [0.0,0.0,0.0]
> pt2 =[1.0,1.0,0.0]
>
> ?
>
> Mark
>
>
>
> On 2/02/2012 7:12 AM, DANIEL POSE wrote:
>
>> Hello Mark,
>>
>> I understand the AutoCAD problem, but in my profession it is the most
>> extended software for CAD. In my opinion it justify the efford to make
>> automation tools.
>> Here I post the answer from Python when I try to draw a line using
>> win32com.client code in my last mail:
>>
>> Traceback (most recent call last):
>>   File "", line 1, in 
>>   File
>> "C:\Python27\lib\site-**packages\spyderlib\widgets\**
>> externalshell\startup.py",
>> line 128, in runfile
>> execfile(filename, glbs)
>>   File "C:\Documents and Settings\Usuario\Escritorio\**borrar.py", line
>> 15, in 
>> line = ms.AddLine(pt1, pt2) #This draw a line in AutoCAD
>>   File ">", line 3, in AddLine
>> com_error: (-2147352567, 'Ocurri\xf3 una excepci\xf3n.', (0, None, None,
>> None, 0, -2147024809), None)
>>
>> Thank you in advance,
>> Daniel Pose.
>>
>> 2012/2/1 Mark Hammond > >
>>
>>
>>Sadly not many people have access to autocad so it is hard to test.
>>What errors do you get using win32com?
>>
>>Mark
>>
>>
>>On 1/02/2012 5:11 AM, DANIEL POSE wrote:
>>
>>Hello,
>>
>>Recently I try to write some code to automate AutoCAD from Python.
>> I
>>have to draw lines from Python using win32com.client module, but I
>>obtain error. By other hand I solved the problem using comtypes
>>module.
>>However, If I try to obtain block attributes information, comtypes
>>doesn't work but win32com.client work properly.
>>
>>AutoCAD attributes working code (work for win32com.client but no
>> for
>>comtypes):
>>[code]
>>import win32com.client
>>acad= win32com.client.Dispatch("__**AutoCAD.Application")
>>doc = acad.ActiveDocument
>>seleccion=doc.SelectionSets.__**Add('selection1')
>>
>>seleccion.SelectOnScreen()
>>for objeto in seleccion:
>> if objeto.ObjectName=='__**AcDbBlockReference':
>> bloque=objeto.GetAttributes()
>> bloque[0].TagString='__**newattributename' #This change
>>
>>the name
>>for the first attribute in the selected block
>>[/code]
>>
>>Draw line (work for comtypes but doesn't work for win32com.client):
>>[code]
>>import comtypes.client
>>import array
>>acad = comtypes.client.__**GetActiveObject("AutoCAD.__**
>> Application")
>>
>>doc = acad.ActiveDocument
>>ms = doc.ModelSpace
>>pt1 = array.array('d', [0.0,0.0,0.0])
>>pt2=array.array('d',[1.0,1.0,_**_0.0])
>>
>>line = ms.AddLine(pt1, pt2) #This draw a line in AutoCAD
>>[\code]
>>
>>My question is: Is posible to fix the problem using win32com to
>> draw
>>autocad line in order to avoid comtypes use?
>>I found on the web several coments to the problem, but no solution.
>>
>>Thanks for help,
>>Daniel Pose.
>>
>>
>>__**___
>>python-win32 mailing list
>>python-win32@python.org 
>> > >
>>
>> http://mail.python.org/__**mailman/listinfo/python-win32
>>
>> 
>> >
>>
>>
>>
>>
>
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] python 3 support

2012-02-01 Thread Mark Hammond

On 2/02/2012 8:43 AM, Roman Morawek wrote:

On 01.02.2012 21:51, Brian Curtin wrote:

It has supported Python 3 since at least 2009.


Interesting. It seems I just got confused by the list of the 25 most
often nominated packages where users desire Python 3 support:
http://python.org/3kpoll

There is a hint on how to unlist the package there. The package author
may want to do this.


Thanks for pointing that out - I think I've followed the instructions so 
it should be removed soon.


Cheers,

Mark
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] problem AddLine AutoCAD win32com.client

2012-02-01 Thread Dan Glassman
Daniel,

I've tested a prerelease version of pywin32 that contains the new
win32com.client.VARIANT class and it works well with AutoCAD.  Once
released, you can write something like this:


import win32com.client
import pythoncom

def POINT(x,y,z):
   return win32com.client.VARIANT(pythoncom.VT_ARRAY | pythoncom.VT_R8,
(x,y,z))

acad = win32com.client.Dispatch('AutoCAD.Application')
ms = acad.ActiveDocument.ModelSpace
ms.AddLine(POINT(0,0,0), POINT(1,1,0))

Additional information in Mark's original post on win32com.client.VARIANT:
http://mail.python.org/pipermail/python-win32/2011-October/011844.html

-drg

On Wed, Feb 1, 2012 at 5:29 PM, DANIEL POSE  wrote:

> I have used array module because it worked with comtypes module. If I use
> simple list it doesn't work with comtypes nor pywin32.
> If I use:
>
> pt1 = [0.0,0.0,0.0]
> pt2 =[1.0,1.0,0.0]
>
> Then Python responds:
>
> 
>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File
> "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\startup.py",
> line 128, in runfile
> execfile(filename, glbs)
>   File "C:\Documents and Settings\Administrador\Mis
> documentos\DropboxDani\Dropbox\PYTHON\PruebaAutoCADLinea.py", line 16, in
> 
> line = ms.AddLine(pt1, pt2)
>
>   File ">", line 3, in AddLine
> com_error: (-2147352567, 'Ocurri\xf3 una excepci\xf3n.', (0, None, None,
> None, 0, -2147024809), None)
>
> 
>
>
> 2012/2/1 Mark Hammond 
>
>> Re-added the python-win32 list - please keep replies on list.
>>
>> Your code uses:
>>
>>
>> > pt1 = array.array('d', [0.0,0.0,0.0])
>> > pt2=array.array('d',[1.0,1.0,_**_0.0])
>>
>> But these aren't supported by pywin32 in the way you expect - what
>> happens if you change this to:
>>
>> pt1 = [0.0,0.0,0.0]
>> pt2 =[1.0,1.0,0.0]
>>
>> ?
>>
>> Mark
>>
>>
>>
>> On 2/02/2012 7:12 AM, DANIEL POSE wrote:
>>
>>> Hello Mark,
>>>
>>> I understand the AutoCAD problem, but in my profession it is the most
>>> extended software for CAD. In my opinion it justify the efford to make
>>> automation tools.
>>> Here I post the answer from Python when I try to draw a line using
>>> win32com.client code in my last mail:
>>>
>>> Traceback (most recent call last):
>>>   File "", line 1, in 
>>>   File
>>> "C:\Python27\lib\site-**packages\spyderlib\widgets\**
>>> externalshell\startup.py",
>>> line 128, in runfile
>>> execfile(filename, glbs)
>>>   File "C:\Documents and Settings\Usuario\Escritorio\**borrar.py", line
>>> 15, in 
>>> line = ms.AddLine(pt1, pt2) #This draw a line in AutoCAD
>>>   File ">", line 3, in AddLine
>>> com_error: (-2147352567, 'Ocurri\xf3 una excepci\xf3n.', (0, None, None,
>>> None, 0, -2147024809), None)
>>>
>>> Thank you in advance,
>>> Daniel Pose.
>>>
>>> 2012/2/1 Mark Hammond >> >
>>>
>>>
>>>Sadly not many people have access to autocad so it is hard to test.
>>>What errors do you get using win32com?
>>>
>>>Mark
>>>
>>>
>>>On 1/02/2012 5:11 AM, DANIEL POSE wrote:
>>>
>>>Hello,
>>>
>>>Recently I try to write some code to automate AutoCAD from
>>> Python. I
>>>have to draw lines from Python using win32com.client module, but I
>>>obtain error. By other hand I solved the problem using comtypes
>>>module.
>>>However, If I try to obtain block attributes information, comtypes
>>>doesn't work but win32com.client work properly.
>>>
>>>AutoCAD attributes working code (work for win32com.client but no
>>> for
>>>comtypes):
>>>[code]
>>>import win32com.client
>>>acad= win32com.client.Dispatch("__**AutoCAD.Application")
>>>doc = acad.ActiveDocument
>>>seleccion=doc.SelectionSets.__**Add('selection1')
>>>
>>>seleccion.SelectOnScreen()
>>>for objeto in seleccion:
>>> if objeto.ObjectName=='__**AcDbBlockReference':
>>> bloque=objeto.GetAttributes()
>>> bloque[0].TagString='__**newattributename' #This change
>>>
>>>the name
>>>for the first attribute in the selected block
>>>[/code]
>>>
>>>Draw line (work for comtypes but doesn't work for
>>> win32com.client):
>>>[code]
>>>import comtypes.client
>>>import array
>>>acad = comtypes.client.__**GetActiveObject("AutoCAD.__**
>>> Application")
>>>
>>>doc = acad.ActiveDocument
>>>ms = doc.ModelSpace
>>>pt1 = array.array('d', [0.0,0.0,0.0])
>>>pt2=array.array('d',[1.0,1.0,_**_0.0])
>>>
>>>line = ms.AddLine(pt1, pt2) #This draw a line in AutoCAD
>>>[\code]
>>>
>>>My question is: Is posible to fix the problem using win32com to
>>> draw
>>>autocad line in order to avoid comtypes use?
>>>I found on the web several coments to the problem, but no
>>> solution.
>>>
>>>Thanks for help,
>>>Daniel Pose.
>>>
>>>
>>>__**_