I'm driving Excel from python, largely successfully. Now I'm trying to
add errorbars to XY scatter plots. Keep getting a com_error. Can't
track down the problem.
I modified a simple example to duplicate the problem. Thanks to Mathieu
Fenniak http://www.stompstompstomp.com/weblog/entries/67/ for the code.
The traceback is shown below. You can see that the Excel chart series
has a method called ErrorBar. But when I try to use it with any or all
of its allowed arguments, it fails. The traceback goes into the guts of
win32com but I don't really have a clue at that point. (Happy to learn
something new though).
The relevant Excel VBA language doc is here. http://msdn.microsoft.com/library/de...HV03076818.asp
Hope someone can help. Losing hair .... fast!
In [16]: %run test.py
--Return-- c:\python23\lib\pdb.py(992)set_trace()->None
-> Pdb().set_trace()
(Pdb) c
There's a method waiting
---------------------------------------------------------------------------
pywintypes.com_error Traceback (most
recent call
last)
c:\temp\mpival\test.py
79
80 # A simple example:
---> 81 plot( (1,2,3,4,5), (6,7,8,9,10) )
82
83 # Some more data:
c:\temp\mpival\test.py in plot(x, y, xAxisLog, yAxisLog)
35 if series.ErrorBar:
36 print "There's a method waiting"
---> 37 series.ErrorBar(Direction = constants.xlY)
38
39
C:\Python23\lib\site-packages\win32com\gen_py\00020813-0000-0000-C000-0000000000
46x0x1x4.py in ErrorBar(self, Direction, Include, Type, Amount,
MinusValues)
22722 , MinusValues=defaultNamedOptArg):
22723 return self._ApplyTypes_(152, 1, (12, 0), ((3,
1), (3, 1
), (3, 1), (12, 17), (12, 17)), 'ErrorBar', None,Direction 22724 , Include, Type, Amount, MinusValues)
22725
22726 def Paste(self):
C:\Python23\lib\site-packages\win32com\client\__init__.py in
_ApplyTypes_(self,
dispid, wFlags, retType, argTypes, user, resultCLSID, *args)
444 def _ApplyTypes_(self, dispid, wFlags, retType,
argTypes, user,
445 resultCLSID, *args):
--> 446 return self._get_good_object_(
447 self._oleobj_.InvokeTypes(
448 dispid, 0, wFlags, retType,
argTypes, *arg
s),
com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft Excel',
'ErrorBar
method of Series class failed', 'C:\\Program Files (x86)\\Microsoft
Office\\Off
ice10\\1033\\xlmain10.chm', 0, -2146827284), None)
WARNING: Failure executing file: <test.py> 2 2370
<cf********@gmail.com> wrote in message news:11**********************@g10g2000cwb.googlegr oups.com... I'm driving Excel from python, largely successfully. Now I'm trying to add errorbars to XY scatter plots. Keep getting a com_error. Can't track down the problem.
I modified a simple example to duplicate the problem. Thanks to Mathieu Fenniak http://www.stompstompstomp.com/weblog/entries/67/ for the code.
The traceback is shown below. You can see that the Excel chart series has a method called ErrorBar. But when I try to use it with any or all of its allowed arguments, it fails. The traceback goes into the guts of win32com but I don't really have a clue at that point. (Happy to learn something new though).
The relevant Excel VBA language doc is here. http://msdn.microsoft.com/library/de...HV03076818.asp
Hope someone can help. Losing hair .... fast! In [16]: %run test.py --Return-- c:\python23\lib\pdb.py(992)set_trace()->None -> Pdb().set_trace() (Pdb) c There's a method waiting --------------------------------------------------------------------------- pywintypes.com_error Traceback (most recent call last)
c:\temp\mpival\test.py 79 80 # A simple example: ---> 81 plot( (1,2,3,4,5), (6,7,8,9,10) ) 82 83 # Some more data:
c:\temp\mpival\test.py in plot(x, y, xAxisLog, yAxisLog) 35 if series.ErrorBar: 36 print "There's a method waiting" ---> 37 series.ErrorBar(Direction = constants.xlY)
According to the docs, the Include and Type arguments are
required, and they're not being passed to the method.
hth
Roger
----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
yth (Yes That Helped).
You know how it goes, I thought I'd already tried to include all
arguments. Obviously I didn't, or stuffed it up in some other way.
Also some confusion about the meaning of "required" and "default". The
doc explains these arguments as required, but some have defaults. I
guess I thought if they had defaults then they didn't need to be
specified.
Anyway, problem solved. Thanks again. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: RJ |
last post by:
Hi,
I've been going over the Quick Start to Client side COM and Python and many
other sources, but cannot find an example that will get my com/ActiveX .ocx
USB device driver imported.
The Excel...
|
by: Patrick |
last post by:
I am investigating a web-based app wherein I wanted to provide html
form frontends to an Excel spreadsheet sitting on a MS Windows server;
with each authenticated HTTP user having thier own...
|
by: koia |
last post by:
Hi,
I have a problem with adding attributes to a Line in an Excel drawing
using the Python win32com interface. From recording in Excel I get the
Macro:
Sub Makro1()...
|
by: Ransom |
last post by:
Hey folks...
Newbie here. I'm working with win32com launching, closing and
re-launching Excel grabbing output and doing stuff.
Well, on some occasions, I get the following error:
...
|
by: vithi |
last post by:
Hi'
I am trying to launch an application. When I try like that
When I try like that Excel is opening
import win32com.client
object = win32com.client.Dispatch("Excel.Application")
object.Visible...
|
by: Ray |
last post by:
Hi,
I need to use cell's background color.
when I record a macro from excel, it shows:
Rows("7:7").Select
With Selection.Interior
.ColorIndex = 8
.Pattern = xlSolid
|
by: SPJ |
last post by:
Sorry, forgot to mention Subject in my earlier post, hence reposting.
------------
I am writing a script which need's to convert an excel file to csv (text) format. For that I am using the...
|
by: sterling |
last post by:
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 =...
|
by: korean_dave |
last post by:
Hi. I need a dummy's explanation to utilizing the win32com component
to access Microsoft Excel.
So far, I have this code.
import win32com.client
xl =...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
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,...
|
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...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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,...
|
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...
| |