473,406 Members | 2,467 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,406 software developers and data experts.

win32com and numpy

I am trying to use Excel as the front end for some python code.

I get an error (below) when trying to use a python code including numpy. If I don't import numpy I do not get the error. Is win32 somehow incompatible with numpy? I would appreciate any information regarding this issue.


Minimal example:

Expand|Select|Wrap|Line Numbers
  1. import win32com.server.register
  2. import pythoncom
  3. from numpy import mean
  4.  
  5. class TimeSeriesManipulation:
  6.     _public_methods_ = [ 'SplitString']
  7.     _reg_progid_ = "PythonUtils.NumpyError"
  8.     _reg_clsid_ = "{08A4D1F8-0185-4692-BE40-4AD081DB90B1}"
  9.  
  10.  
  11.     def SplitString(self, val, item=None):
  12.         from string import split
  13.         if item != None: item = str(item)
  14.         return split(str(val), item)
  15.  
  16. if __name__=='__main__':
  17.     print "Registering COM server..."
  18.     import win32com.server.register
  19.   win32com.server.register.UseCommandLine(TimeSeriesManipulation)
  20.  
  21.  
Expand|Select|Wrap|Line Numbers
  1. Sub tt()
  2. Set PythonUtils = CreateObject("PythonUtils.NumpyError")
  3. response = PythonUtils.SplitString("Hello from VB")
  4. For Each Item In response
  5. MsgBox Item
  6. Next
  7. End Sub
  8.  
I get a run-time error ' -21474677259(80004005)':

Unexpected Python Error: Traceback (most recent call last):
File "C:\appl\python26\lib\site-packages\win32com\server\policy.py",
line 136 in CreateInstance
return retObj._CreateInstance_(clsid, reqIID)
File "C:\appl\python26\lib\site-packages\win32com\server\policy.py",
line 194, in _CreateInstance_
mvob = call func(classSpec)
Jan 17 '11 #1
2 3319
dwblas
626 Expert 512MB
line 194, in _CreateInstance_
mvob = call func(classSpec)
This line in not in the code you posted so it is difficult to tell. Note that the Numpy that you install has to match the Python version. So there are separate Numpy packages for Python2.5, 2.6, and 2.7.
Jan 17 '11 #2
To clarify:
Importing any function from numpy triggers an error when using the com object in excel. If I do not import anything from numpy, I do not get any errors.
Jan 18 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Justin Stockton | last post by:
I recently upgraded from ActivePython 2.2.2 to ActivePython 2.3.2 and I'm running into an issue importing the win32com.client module. Before installing the new version, I made sure to properly...
3
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...
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...
13
by: Gary Wessle | last post by:
Hi I am trying to install NumPy in my debian/testing linux 2.6.15-1-686. with no numpy for debian/testing, I am left alone, since the experimental version available by debian will result in a...
3
by: Iljya | last post by:
Hello, I need to pickle the type numpy.float32 but encounter an error when I try to do so. I am able to pickle the array itself, it is specifically the type that I cannot pickle. I am using:...
2
by: Chris Smith | last post by:
Howdy, I'm a college student and for one of we are writing programs to numerically compute the parameters of antenna arrays. I decided to use Python to code up my programs. Up to now I haven't...
5
by: robert | last post by:
Turning algs for old NumPy modules into numpy code I suffer from this: Upon further processing of returns of numpy calculations, lots of data in an apps object tree will become elementary numpy...
5
by: jonas | last post by:
I have a series of arrays that I would like to send to excel for display and processing After spending most of the evening google I cant find anything out there that gives an example to what I...
3
by: vml | last post by:
Hello, I am really new in python scipy win32com and scipy I tried to setup a COM server to interact with vb 6 the pythom COM server is : from win32com.server import exception, register import...
2
by: Travis Oliphant | last post by:
I wanted to point anybody interested to a blog post that describes a useful pattern for having a NumPy array that points to the memory created by a different memory manager than the standard one...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
0
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...
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
tracyyun
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 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.