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

Converting _node* to a Code object?

Hi All,

I have an application with an embedded python interpreter and i need to
get the embedded interpreter to "import" strangely named files as python
modules.

Anyhow the simple part of the question is:

How do i convert a _node* object returned from:
PyParser_SimpleParseStringFlagsFilename()

into a code object i can use as a module to import with:
PyImport_ExecCodeModule()
I cant seem to find any documentation about this. If you are wondering
why i want to do this, then you can read on and maybe there is a much
better way to achieve what i am after.

Thanks,
Brendon


----- What i am trying to achieve -----
Basically i want to "import" using the python C API a module from
various files which may have names that do not make valid python module
names.
In particular i have an embedded python interpreter that is used to
apply a number of operations on some data based on a user supplied
"suppressions file" (*.eds). This .eds file is just a python source file
designed only to be used from within this application.
Now the names of these suppression files usually matche that of a
library or application to which they will apply to. For example:

libstdc++.so.6.0.5 : has eds file: libstdc++.so.6.0.5.eds
Now i want to have my code import this eds file as a python module so
that i can then use it as any other standard python module. So i need to
separate the name of the module from the name of the file. I was
thinking for example for the above filename i would give it a module
name like:

libstdc___so_6_0_5

(The name is not important just that the above one is a valid module
name from what i understand and it is based on the original name)

So i have some random file:
/foo/bar/lib/libstdc++.so.6.0.5.eds

and i want to be able to import that as a module using the Python C API
so native python code can access the module like:

libstdc___so_6_0_5.PostCalculation()
If you have any better method of doing this, i would love to know what
it is.

Thanks in advance for any help,
Brendon.
Apr 1 '07 #1
0 984

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

Similar topics

3
by: Parvesh | last post by:
hi, I am using a webservice which Returns the Result in an XML string, The XML response i get i svery cumbersome to parse, But if i could convert it to the Corresponding Class using the...
4
by: gg9h0st | last post by:
i'm a newbie studying php. i was into array part on tutorial and it says i'll get an array having keys that from member variable's name by converting an object to array. i guessed "i can...
9
by: Terry | last post by:
I am converting (attempting) some vb6 code that makes vast use of interfaces. One of the major uses is to be able to split out Read-only access to an obect. Let me give you a simple (contrived)...
2
by: shenanwei | last post by:
DB2 V8.2 on AIX, type II index is created. I see this from deadlock event monitor. 5) Deadlocked Connection ... Participant no.: 2 Lock wait start time: 09/18/2006 23:04:09.911774 .........
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.