473,387 Members | 1,516 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.

help on eval()-like but return module object

As I'm adding XMLRPC support in my apps, I'd like to send a module in
server to be executed in client. My plan in sending the file content via
xmlrpc, and doing compile + eval, but eval just execute the code object
without returning the module.

Original:

import mymodule
mymodule.run(request)

Wish:

string_code = rpc_con.GetModule('mymodule')
code_obj = compile(string_code, '<string>', 'exec')
mymodule = eval(code_obj)
mymodule.run(request)

Any helps on this topic would be highly appreciated. Thanks!

--
dsw
Jan 12 '06 #1
1 1063
Dody Suria Wijaya wrote:
Any helps on this topic would be highly appreciated. Thanks!


You can use new.module to create a new module, and exec to
execute some code in the module:

py> m = new.module("Hallo")
py> exec "a=3" in m.__dict__
py> m.a
3
py> m
<module 'Hallo' (built-in)>

Regards,
Martin
Jan 13 '06 #2

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

Similar topics

4
by: fartsniff | last post by:
Hello all. Can someone help out ? I found this PHP code that works just fine, however, I am trying to put it back into its original Javascript form. I am still learning the syntax, etc. for...
14
by: KL | last post by:
I am writing this function and I think I messed up something cause it won't work. Can someone help me see what I am doing wrong?? I have included the function and the part where I call the...
3
by: |:::. George .::::| | last post by:
Hi, When I put the first javascript, it works fine. As soon as I put the second one, the effect stops on both and you can't see any pictures. This is the script I'm using. {How can I have this...
21
by: cjl | last post by:
Hey all: I have the following (ugly) code: function preload() { if (cr_series.length >1) preloadCR(); if (ct_series.length >1) preloadCT(); if (mr_series.length >1) preloadMR(); if...
1
by: Donnie | last post by:
Hello I'm receiving the following error message when I try to view an aspx page in Design view "Could not open in Design View. Quote values differently inside a '<%... "value" ... %>' block ...
4
by: Chris | last post by:
I've tried several posting examples to no avail. I'm trying to pass two parameters to the hyperlink inside of the grid. I've gone to this link that was posted, and besides the typo (missing '>') I...
3
by: vishnu | last post by:
Hi, I have a link that is coming from the database.Now if the link is empty i dont want to display in datalist .How can i do that? <td><asp:DataList id="DataList1" Runat="server"...
5
by: katie smith | last post by:
Here is the program I just started, The problem i am having is I'm trying to get it to load the image file Sand1 with eval(loader) = pygame.image.load(loader) because Loader is euqual to "Sand1" but...
0
by: joelgarcia007 | last post by:
I really hope someone can help me with this because it's really driving me crazy. I need to dynamically display multiple data tables on a page so I am using a Repeater to do so and in the...
2
by: eebee | last post by:
Hi, I've been trying for a few hours now, but cannot resolve this: In IE7 it works, but not in : I'm using a HoverMenuExtender in a Listview. As soon as I'm using an updatepanel, the popup...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.