473,769 Members | 2,355 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling Access module functions from python

Hi,

I have an Access Data Project (.adp) that I am trying to open and
execute from Python. I am using the win32com.client , and I have
successfully opened the application, but I'm getting an exception when
I try to execute the function (actually a "Sub" that returns void, but
that shouldn't matter). Here's what I have so far:
conn=win32com.c lient.Dispatch( 'Access.Applica tion')
conn.OpenAccess Project("C:/path/to/file/filename.adp")
conn.Visible = 1
# works so far

conn.Run("test_ interface")

# Exception is thrown here.
# com_error: (-2147352567, 'Exception occurred.', (0, None, None, None,
0, -2147352562), None)

The 'test_interface ' function takes no arguments, but I've tried the
same thing with another function that does take arguments and gotten
the same result.

Any help would be appreciated.

Thanks,
kayakerjess

Sep 21 '05 #1
1 2138
>>>>> "kayakerjes s" == kayakerjess <ka*********@ho tmail.com> writes:

kayakerjess> Hi, I have an Access Data Project (.adp) that I am
kayakerjess> trying to open and execute from Python. I am using
kayakerjess> the win32com.client , and I have successfully opened
kayakerjess> the application, but I'm getting an exception when I
kayakerjess> try to execute the function (actually a "Sub" that
kayakerjess> returns void, but that shouldn't matter). Here's
kayakerjess> what I have so far:
kayakerjess> conn=win32com.c lient.Dispatch( 'Access.Applica tion')
kayakerjess> conn.OpenAccess Project("C:/path/to/file/filename.adp")
kayakerjess> conn.Visible = 1 # works so far

kayakerjess> conn.Run("test_ interface")

kayakerjess> # Exception is thrown here. # com_error:
kayakerjess> (-2147352567, 'Exception occurred.', (0, None, None,
kayakerjess> None, 0, -2147352562), None)

kayakerjess> The 'test_interface ' function takes no arguments, but
kayakerjess> I've tried the same thing with another function that
kayakerjess> does take arguments and gotten the same result.

kayakerjess> Any help would be appreciated.

kayakerjess> Thanks, kayakerjess

Assuming you have a copy of Access, no?
I would recommend lighting off Access, and exploring the Modules
collection. Possibly start a new file, and see if you can prototype
your python code in Visceral Baysuck for crApplications, (which is
actually a better tool than my sophomoric comment implies).
The modules collection may let you invoke a Sub in one of them.
Google might also yield something.
HTH,
Chris
Sep 23 '05 #2

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

Similar topics

2
4460
by: Marc Shapiro | last post by:
I am relatively new to python (I have used it on and off for a few small projects over the last few years) so I imagine that what I am trying to do has already been done, but practical experience, even if it is reinventing the wheel, is still useful, so... I am trying to write a module to handle drop down menus using curses (on linux). Curses seems to have a wrapper for the panels library, but not forms, or menus. I am not even sure...
1
2601
by: Peter Åstrand | last post by:
There's a new PEP available: PEP 324: popen5 - New POSIX process module A copy is included below. Comments are appreciated. ---- PEP: 324 Title: popen5 - New POSIX process module
10
2043
by: Kyler Laird | last post by:
I need to submit C/C++ code for a class. (It's not a programming class. The choice of language is inertial. I think that it mostly serves to distract students from the course subject.) I'm fairly fluent with C but it hurts to think about writing in C when Python is *so* much more appropriate for these operations. I'd like to keep my sanity and satisfy the course requirements by programming in Python and converting the code to C. It...
8
3866
by: Bo Peng | last post by:
Dear list, I am writing a Python extension module that needs a way to expose pieces of a big C array to python. Currently, I am using NumPy like the following: PyObject* res = PyArray_FromDimsAndData(1, int*dim, PyArray_DOUBLE, char*buf); Users will get a Numeric Array object and can change its values (and actually change the underlying C array).
9
1634
by: Sean | last post by:
Is there any way I could have the following work? First I would have a module define a function to do something like print some data. ----- module_name.py ----- def print_this(data):
5
2158
by: Pekka Niiranen | last post by:
Hi there, I have two scripts. The first "main.py" sets some variables and then imports another called "gen.py". The idea is to provide "main.py" that defines some paths, variables etc. without using Windows environment variables. Various other "hackers" will make additional Python scripts (subroutines) like "gen.py" that utilize variables set by the "main.py" and which "main.py" calls. I can do this with "subprocess" module by setting...
11
7370
by: Sambo | last post by:
I have the following module: ------------------------------- import math def ac_add_a_ph( amp1, ph1, amp2, ph2 ): amp3 = 0.0 ph3 = 0.0 ac1 = ( 0, 0j ) ac2 = ( 0, 0j )
3
5468
by: David Bear | last post by:
I have a hash function written by another organization that I need to use. It is implemented in perl. I've been attempting to decode what they are doing in their hash function and it is taking way too long. I've identified two functions in a perl module that I would like to 'call' from a python program. I found the following: http://www.annocpan.org/~GAAS/pyperl-1.0/perlmodule.pod and wondered if anyone had any comments. This thing...
4
6001
by: RgeeK | last post by:
I have a main module doStuff.py and another module utility.py. At the start of doStuff.py I call import utility.py Then I also proceed to initiallize some global variables sName = "" Then I create a class, some methods etc. In one of the methods I assign
1
2794
by: Martin Rubey | last post by:
Dear all, I'm trying to call from common lisp functions written for Sage (www.sagemath.org), which in turn is written in python. To do so, I tried http://common-lisp.net/project/python-on-lisp/. It was quite easy to get it to run and do some simple things with python. However, I was unable to get sage to run within it. If I start my local python 2.5 and follow (roughly)
0
9589
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10222
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10050
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7413
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3570
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.