PythonWin -vs- Idle

2009-02-26 Thread Gary Schells


Hello,

Python newbie here.  I am working with Python and geoprocessing in
ArcGIS.  I'm taking a training course online and the exercise I'm
working on makes mention of using PythonWin instead of Idle.



I am using version 2.5 and have not been able to locate PythonWin.  The
download just includes Idle for the environment.  Can anyone point me
in the right direction to download the PythonWin piece of this puzzle?



Thank you

_
It’s the same Hotmail®. If by “same” you mean up to 70% faster. 
http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_AE_Same_022009--
http://mail.python.org/mailman/listinfo/python-list


Re: PythonWin -vs- Idle

2009-02-26 Thread Chris Rebert
On Thu, Feb 26, 2009 at 2:23 PM, Gary Schells gsche...@hotmail.com wrote:

 Hello,
 Python newbie here.  I am working with Python and geoprocessing in ArcGIS.
 I'm taking a training course online and the exercise I'm working on makes
 mention of using PythonWin instead of Idle.

 I am using version 2.5 and have not been able to locate PythonWin.  The
 download just includes Idle for the environment.  Can anyone point me in the
 right direction to download the PythonWin piece of this puzzle?

Seems to be included in http://sourceforge.net/projects/pywin32/

Cheers,
Chris

-- 
Follow the path of the Iguana...
http://rebertia.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: PythonWin -vs- Idle

2009-02-26 Thread Steve Holden
Chris Rebert wrote:
 On Thu, Feb 26, 2009 at 2:23 PM, Gary Schells gsche...@hotmail.com wrote:
 Hello,
 Python newbie here.  I am working with Python and geoprocessing in ArcGIS.
 I'm taking a training course online and the exercise I'm working on makes
 mention of using PythonWin instead of Idle.

 I am using version 2.5 and have not been able to locate PythonWin.  The
 download just includes Idle for the environment.  Can anyone point me in the
 right direction to download the PythonWin piece of this puzzle?
 
 Seems to be included in http://sourceforge.net/projects/pywin32/
 
And it's well worth getting, since it's the recommended programming
environment for ArcGIS. IIRC it uses the COM server capabilities to
achieve some of the required magic.

regards
 Steve
-- 
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC  http://www.holdenweb.com/

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


Re: PythonWin -vs- Idle

2009-02-26 Thread alex23
On Feb 27, 8:40 am, Chris Rebert c...@rebertia.com wrote:
 On Thu, Feb 26, 2009 at 2:23 PM, Gary Schells gsche...@hotmail.com wrote:
  I am using version 2.5 and have not been able to locate PythonWin.  The
  download just includes Idle for the environment.  Can anyone point me in the
  right direction to download the PythonWin piece of this puzzle?

 Seems to be included in http://sourceforge.net/projects/pywin32/

It's also bundled with ActiveState's ActivePython:

http://www.activestate.com/activepython/
--
http://mail.python.org/mailman/listinfo/python-list


Re: PythonWin -vs- Idle

2009-02-26 Thread Niklas Norrthon
On 27 Feb, 01:40, Steve Holden st...@holdenweb.com wrote:
 Chris Rebert wrote:
  On Thu, Feb 26, 2009 at 2:23 PM, Gary Schells gsche...@hotmail.com wrote:
  Hello,
  Python newbie here.  I am working with Python and geoprocessing in ArcGIS.
  I'm taking a training course online and the exercise I'm working on makes
  mention of using PythonWin instead of Idle.

  I am using version 2.5 and have not been able to locate PythonWin.  The
  download just includes Idle for the environment.  Can anyone point me in 
  the
  right direction to download the PythonWin piece of this puzzle?

  Seems to be included inhttp://sourceforge.net/projects/pywin32/

 And it's well worth getting, since it's the recommended programming
 environment for ArcGIS. IIRC it uses the COM server capabilities to
 achieve some of the required magic.

It's the recommended programming environment in ESRI's geoprocessing
classes.
The only stuff that is specific to PythonWin is the debugging, (which
you can
do in IDLE too, just in a slightly different way).

Personally I do most of my python hacking in emacs, both when my code
calls
arcgisscripting and otherwise. Sometimes I use IDLE, since in emacs
(and PythonWin)
I miss the ability to restart the interpreter process to get a clean
environment.

There is one thing I use the pywin32 library for, and that is a little
hack to
get around the issue that each version of ArcGIS is bound to a
specific python version:

try:
import arcgisscripting
except ImportError:
import win32com.client
class arcgisscripting(object):
@staticmethod
def create():
return win32com.client.Dispatch
('esriGeoprocessing.GpDispatch.1')

With this little code snippet in a utility module, I can use python
2.6 with ArcGIS, and I can test my scritps with python 2.4, to ensure
that they run in ArcGIS 9.2 environments.

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


Re: win32com ChartObject pythonwin vs idle

2008-08-01 Thread sterling
On Jul 31, 11:22 pm, Roger Upole [EMAIL PROTECTED] wrote:
 sterling [EMAIL PROTECTED] wrote in message

 news:[EMAIL PROTECTED]





  I'm curious as to why the difference between IDLE and pythonWin when
  using win32com.
  opening an excel file, i've attempted to grab the chart information
  out of the file.

  commands like co = ChartObjects(1)  works in pythonWin but doesn't
  work in IDLE.

  however, on both co = chartobjects(1) works just fine.

  The same goes other things like SeriesCollection()/
  seriescollection(1),seriescollection(2)..., Close()/close

  Is there any way to fix it such that IDLE works with ChartObject()
  too?  I'd really like to be able to use ChartObject().Count() (there
  doesn't seem to be an equivalent chartobject.count)

  Thanks.

 This was probably due to a conflict with the way IDLE sets the locale.
 Bug report 
 here:http://sourceforge.net/tracker/index.php?func=detailaid=2006053grou...

 This is fixed in build 212, just released today.

           Roger- Hide quoted text -

 - Show quoted text -

Thanks for the tip Roger.  Installed 212 and it worked right away!
--
http://mail.python.org/mailman/listinfo/python-list


Re: win32com ChartObject pythonwin vs idle

2008-07-31 Thread Tim Golden

sterling wrote:

I'm curious as to why the difference between IDLE and pythonWin when
using win32com.
opening an excel file, i've attempted to grab the chart information
out of the file.

commands like co = ChartObjects(1)  works in pythonWin but doesn't
work in IDLE.

however, on both co = chartobjects(1) works just fine.


I can't speak for IDLE vs PythonWin but in general
case-sensitivity of win32com stuff is related to
early vs late Dispatch. If you've explicitly generated
proxy modules for the Excel objects (via makepy,
EnsureDispatch or whatever) then those are Python
modules with case-sensitivity. If you're using dynamic
dispatch then Python is simply passing your attribute
name along to COM, which isn't case-sensitive, so either
case will work.

Not sure why IDLE vs PythonWin should make a difference
here, but maybe the above explanation sheds some light...

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


Re: win32com ChartObject pythonwin vs idle

2008-07-31 Thread sterling
On Jul 31, 4:28 am, Tim Golden [EMAIL PROTECTED] wrote:
 sterling wrote:
  I'm curious as to why the difference between IDLE and pythonWin when
  using win32com.
  opening an excel file, i've attempted to grab the chart information
  out of the file.

  commands like co = ChartObjects(1)  works in pythonWin but doesn't
  work in IDLE.

  however, on both co = chartobjects(1) works just fine.

 I can't speak for IDLE vs PythonWin but in general
 case-sensitivity of win32com stuff is related to
 early vs late Dispatch. If you've explicitly generated
 proxy modules for the Excel objects (via makepy,
 EnsureDispatch or whatever) then those are Python
 modules with case-sensitivity. If you're using dynamic
 dispatch then Python is simply passing your attribute
 name along to COM, which isn't case-sensitive, so either
 case will work.

 Not sure why IDLE vs PythonWin should make a difference
 here, but maybe the above explanation sheds some light...

 TJG

Thanks Tim.  I'm wondering if it's an OS issues with Vista (I'm
strangly ashamed to admit that both my laptop and main computer are
running it).
I decided to try the same code on my main computer (do most of my work
on my laptop) and the exact same thing has happened: I can run it in
pythonwin and not idle.
I found that I can't even run Open (I must have been running open()
previously):
i.e.
 import win32com.client
 ex = win32com.client.Dispatch(Excel.Application)
 wb = ex.Workbooks.Open(C:\Temp\SalesChart.xls)

Traceback (most recent call last):
  File pyshell#2, line 1, in module
wb = ex.Workbooks.Open(C:\Temp\SalesChart.xlsx)
  File C:\Python25\Lib\site-packages\win32com\client\dynamic.py,
line 467, in __getattr__
if self._olerepr_.mapFuncs.has_key(attr): return
self._make_method_(attr)
  File C:\Python25\Lib\site-packages\win32com\client\dynamic.py,
line 295, in _make_method_
methodCodeList =
self._olerepr_.MakeFuncMethod(self._olerepr_.mapFuncs[name],
methodName,0)
  File C:\Python25\Lib\site-packages\win32com\client\build.py, line
297, in MakeFuncMethod
return self.MakeDispatchFuncMethod(entry, name, bMakeClass)
  File C:\Python25\Lib\site-packages\win32com\client\build.py, line
318, in MakeDispatchFuncMethod
s = linePrefix + 'def ' + name + '(self' + BuildCallList(fdesc,
names, defNamedOptArg, defNamedNotOptArg, defUnnamedArg, defOutArg) +
'):'
  File C:\Python25\Lib\site-packages\win32com\client\build.py, line
604, in BuildCallList
argName = MakePublicAttributeName(argName)
  File C:\Python25\Lib\site-packages\win32com\client\build.py, line
542, in MakePublicAttributeName
return filter( lambda char: char in valid_identifier_chars,
className)
  File C:\Python25\Lib\site-packages\win32com\client\build.py, line
542, in lambda
return filter( lambda char: char in valid_identifier_chars,
className)
UnicodeDecodeError: 'ascii' codec can't decode byte 0x83 in position
52: ordinal not in range(128)


but the exact same code works in PythonWin. Perhaps I will just find a
way to code everything I want in the older lowercase.
--
http://mail.python.org/mailman/listinfo/python-list


Re: win32com ChartObject pythonwin vs idle

2008-07-31 Thread Roger Upole

sterling [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 I'm curious as to why the difference between IDLE and pythonWin when
 using win32com.
 opening an excel file, i've attempted to grab the chart information
 out of the file.

 commands like co = ChartObjects(1)  works in pythonWin but doesn't
 work in IDLE.

 however, on both co = chartobjects(1) works just fine.

 The same goes other things like SeriesCollection()/
 seriescollection(1),seriescollection(2)..., Close()/close

 Is there any way to fix it such that IDLE works with ChartObject()
 too?  I'd really like to be able to use ChartObject().Count() (there
 doesn't seem to be an equivalent chartobject.count)

 Thanks.

This was probably due to a conflict with the way IDLE sets the locale.
Bug report here:
http://sourceforge.net/tracker/index.php?func=detailaid=2006053group_id=78018atid=551954

This is fixed in build 212, just released today.

  Roger



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


win32com ChartObject pythonwin vs idle

2008-07-30 Thread sterling
I'm curious as to why the difference between IDLE and pythonWin when
using win32com.
opening an excel file, i've attempted to grab the chart information
out of the file.

commands like co = ChartObjects(1)  works in pythonWin but doesn't
work in IDLE.

however, on both co = chartobjects(1) works just fine.

The same goes other things like SeriesCollection()/
seriescollection(1),seriescollection(2)..., Close()/close

Is there any way to fix it such that IDLE works with ChartObject()
too?  I'd really like to be able to use ChartObject().Count() (there
doesn't seem to be an equivalent chartobject.count)

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