473,405 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

win32com ChartObject pythonwin vs idle

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.
Jul 31 '08 #1
4 3587
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
Jul 31 '08 #2
On Jul 31, 4:28*am, Tim Golden <m...@timgolden.me.ukwrote:
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_.mapFu ncs[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.
Jul 31 '08 #3

"sterling" <st************@gmail.comwrote in message
news:67**********************************@79g2000h sk.googlegroups.com...
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...18&atid=551954

This is fixed in build 212, just released today.

Roger

Aug 1 '08 #4
On Jul 31, 11:22*pm, "Roger Upole" <rup...@hotmail.comwrote:
"sterling" <sterlingsom...@gmail.comwrote in message

news:67**********************************@79g2000h sk.googlegroups.com...


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...d=2006053&grou...

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!
Aug 2 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Colin J. Williams | last post by:
PythonWin has been my favourite IDE for quite a while. When one right clicks on a .py file in the Windows Explorer, among the options are Open and Edit. The former is the default and executes...
3
by: Tuure Laurinolli | last post by:
Some time ago I was playing with the idea of using an actual IDE to write my python code. I first played with IDLE, but noticed that it was kind of limited and for some reason it worked extremely...
2
by: Chris Lott | last post by:
Can someone elaborate for me what the pywin32 project is exactly? Is PythonWin a replacement for idle? More to the point, do I need to worry about this as I am learning about Python, since Idle and...
2
by: Sibylle Koczian | last post by:
Hello, I've installed Python 2.4 and the win32 extensions, using administrator rights, under Windows XP in "C:\Programme". As this is a directory without spaces I didn't expect any problems. But...
1
by: g.franzkowiak | last post by:
I'm trying to use a proprietary windows software with COM and win32com. The result is everytime the error message com_error: (-2147418113, 'Catastrophic failure', None, None) I've read this in...
3
by: muttu2244 | last post by:
Hi all Am trying to read an html page using win32com in the following way. from win32com.client import Dispatch ie = Dispatch("InternetExplorer.Application")
1
by: Bo Peng | last post by:
Dear list, I am using rpy, a python module to control statistical package R from python. Running the following commands >>> from rpy import * >>> r.plot(0) will pass command 'plot' to R...
3
by: archaegeo | last post by:
I am getting started in Python, and I have looked on both the stackless page and python.org and cannot find the answer to what I think is a simple problem. If I start the python command line or...
11
by: Bill Davy | last post by:
I am trying to edit Contacts in Outlook. This is so I can transfer numbers from my address book which is an Excel spreadsheet to my mobile phone. I came across the following snippet of code which...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.