473,387 Members | 1,549 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,387 software developers and data experts.

PyImport_ImportModule("sys")

Bulldog
I am new to this board and I am using Python 2.2.1 on Windows XP SP2. I am working on embedding some python functionality in a C++ win32 DLL, and I am having issues using the PyImport_ functions available in the python C API. More specifically I am trying to use Pyimport_ImportModule() to import sys, and it doesn't work. I have also tried using PyString_FromString() to convert the the string "sys" to a Python object to then use PyImport_Import(). Can't get it to work. The only way to properly import sys is to use PyRun_SimpleString("import sys"). I think this a pretty standard question but I haven't found a definite answer yet. does the problem come from the fact that sys is a built-in module? What are the limitations on the PyImport_ functions with respect to the different types of module one could try to import? TIA.
Jan 18 '07 #1
2 3227
bartonc
6,596 Expert 4TB
I've never tried to do it that way. I import the low level dll into the high level (Python) module using the ctypes library. That way I get the benefits of both worlds: Low level C doing work that must be optimized or hidden and Python taking care of things like memory management and OS interface.
Jan 18 '07 #2
I am not quite sure I understand your reply!
Jan 18 '07 #3

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

Similar topics

1
by: Borse, Ganesh | last post by:
Hi, Can you please guide me for the following problem? The call to "PyImport_ImportModule("cStringIO");" is failing with an error of "undefined symbol: PyObject_SelfIter". Before importing this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
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...
1
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...
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
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,...

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.