473,513 Members | 2,616 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3599
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
2428
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 Python, with the selected script. The latter activates the PythonWin editor, with the selected script. Since, most frequently, I wish to edit the...
3
1919
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 slowly when started from a shortcut on desktop(not so when started from shortcut in start menu). Then I tried Pythonwin and noticed that it didn't...
2
2171
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 the Windows Installer seem to work fine on my XP box? c
2
7016
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 now I can't _use_ win32com as a normal user, because normal users can't write there: PythonWin 2.4.1 (#65, Mar 30 2005, 09:13:57) on win32....
1
9126
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 some e-mails, but can't find the solution and I have not enough experience with Windows and COM. Can anybody help ?
3
5785
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
1952
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 and run it. I notice that the R-plot will not refresh (a window is created but the figure is not drawn) until the
3
2969
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 idle, i can If I start pythonwin I get the following error ....No Module named Stackless Any help?
11
7654
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 enabled me to the contacts at least list. I had to root around to discover CdoDefaultFolderContacts (though it was guessable; how could I...
0
7270
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7178
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7563
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
5703
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5102
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4757
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3252
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3239
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
470
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.