473,804 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to load the DLL with PyRun_SimpleStr ing?

Hi,

Have anyone know how to import the DLL in C program?
Actually, I have used the statement 'PyRun_SimpleSt ring' to import .PY,

Such as,
r = PyRun_SimpleStr ing("import os");
It's be fine.
If importing the DLL by this commdand,

Such as,
r = PyRun_SimpleStr ing("import example");

return the error code -1.
Should any advice, let me know whatever you try...

Thanks in advance.
Link
Jul 18 '05 #1
3 4537
"Link" <li******@hotma il.com> writes:
Hi,

Have anyone know how to import the DLL in C program?
Actually, I have used the statement 'PyRun_SimpleSt ring' to import
.PY,
Such as,
r = PyRun_SimpleStr ing("import os");
It's be fine.
If importing the DLL by this commdand,

Such as,
r = PyRun_SimpleStr ing("import example");

return the error code -1.


Is the .dll named .pyd? Is the .pyd on your sys.path?
--

Vennlig hilsen

Syver Enstad
Jul 18 '05 #2
Exactelly, the named example is .DLL and put it on the sys.path.

That I had check it carefully.
But the result make me sad what I failed to load.

Could you give me more advice? Such as the other statement for loading DLL
as same as the 'PyRun_SimpleSt ring' command.

Regards,
Link

"Syver Enstad" <sy************ *@online.no>
???????:u1***** ******@online.n o...
"Link" <li******@hotma il.com> writes:
Hi,

Have anyone know how to import the DLL in C program?
Actually, I have used the statement 'PyRun_SimpleSt ring' to import
.PY,
Such as,
r = PyRun_SimpleStr ing("import os");
It's be fine.
If importing the DLL by this commdand,

Such as,
r = PyRun_SimpleStr ing("import example");

return the error code -1.


Is the .dll named .pyd? Is the .pyd on your sys.path?
--

Vennlig hilsen

Syver Enstad

Jul 18 '05 #3
"Link" <li******@hotma il.com> writes:
Exactelly, the named example is .DLL and put it on the sys.path.


Rename the .dll to .pyd.

--

Vennlig hilsen

Syver Enstad
Jul 18 '05 #4

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

Similar topics

0
2803
by: Link | last post by:
Dear, How is the wonderful PYTHON for me. It attracts me with its additional variety. I am developing in C program as well as first to use C++ with extending & embedding PYTHON. It seems not to easy. What do I mean? See that following steps what I am doing.
3
1647
by: Bill Orcutt | last post by:
Having seen the number of lost souls asking questions about embedding Python in the archives of this group, I hesitate to add myself to their number, but I've hit a problem I can't quite get my head around. I have a simple C program that embeds a python interpreter to execute python commands and return stdout, and to a point everything works as intended. The problem that each command seems to be executed in its own context and knows...
6
4328
by: JS | last post by:
EE instance DB2 v7.2.0 fixpack 3 on WIN2K. I select some data from a table A and write it to a file using the COALESCE function and whitespace as the null character: eg coalesce(col1, ' '). This column has 10,000 nulls in table A. Select count(*) from table A where col1 is null=10,000 Using the load utlity, I load the data file as follows into table B which has not null constraint on col1: LOAD FROM LOAD.TEST OF ASC MODIFIED BY...
2
2030
by: **Developer** | last post by:
I have a Form (FV&C) containing a userconrtrol (CF&E) I do a ShowDialog for the form and the form's Load calls a method of the UserControl. The first time I do this the usercontrol appears on the form as I'd expect after the method had been run. The second time I do this the usercontrol appears on the form as if the usercontrols Load had last been run.
3
7205
by: db2udbgirl | last post by:
Env: DB2 UDB 8.2, AIX 5.3 While trying to load data (73 Million rows, Medium size table uses 4K tablespace) into a table using cursor it fails with "SQL0964C The transaction log for the database is full. SQLSTATE=57011" But I felt that Load utility wont log any acvitities on the database. Here it what I tried to do db2 "declare c1 cursor for select CAST(PARTITIONING_NBR AS CHAR(10)), VEH_IDENT_NBR, OPTN_CD, VIN_TYPE_CD,...
2
5949
by: iwl | last post by:
Hello, I'm just starting with Python - would like to embed it in my windows-programm as an script-processor. For tests I use easygui some easy-wrapper for the py-tck-stuff. PyRun_SimpleString("from easygui import *\n"); PyRun_SimpleString("import sys\n"); PyRun_SimpleString("msgbox()\n");
0
993
by: sndive | last post by:
I want to step into PyImport_ImportModule("my_foo") that's failing despite the my_foo.py being in the current directory. (PyRun_SimpleFileEx works on the exact same file). How would I run configure to build libpython with -g? I wonder if I should just keep using PyRun_SimpleFileEx. I want to be able to call arbitrary functions in the imported file/module
0
1019
by: iwl | last post by:
Hi, it seems like I can't trace scripts run by PyRun_SimpleString(): a=0 def test(frame, event, arg): global a a+=1 import sys
3
6408
by: ShambhuHubli | last post by:
Hi all!! .. I am New member to this group. And also new to C/PYTHON API coding. I am trying to have two way communication i,e i am calling from python to C and then from C to python. I have no problem calling c func from python.... But problem is for calling C to Python I am trying to call a python function multiple times by passing one parameter 'fun(param)' from C code . I am getting segmentation fault error while executing . The...
0
9716
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
10604
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
10354
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
10359
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7643
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
6870
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
5536
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
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4314
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.