On 06/15/2010 10:51 PM, Andy Jost wrote:
> Hi,
>
>
>
> I’m working on an application program that embeds Python using the
> C-API. Sometimes, I need to call functions written in pure Python from
> the C code, so I use Py_CompileString and PyEval_EvalCode.
I'd recommend putting your Python code
Hi,
I'm working on an application program that embeds Python using the C-API.
Sometimes, I need to call functions written in pure Python from the C code, so
I use Py_CompileString and PyEval_EvalCode.
I would like to avoid compiling the same code over and over by storing the
result of Py_Compi
On Sep 14, 3:04 am, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> Try forcing mod_python to run your code in the first interpreter
> instance created by Python.
> PythonInterpreter main_interpreter
Thank you very much, that solved the problem! A more detailed
discussion can also be found in the l
on, exc:
> logger.log(logging.CRITICAL, exc.__str__() )
>
> try:
> result_tree = transform(data)
> return etree.tostring(result_tree, 'utf-8')
> except Exception, exc:
> print "xslt processing error!", exc.__str__()
>
On Sep 13, 5:05 pm, Dmitri Fedoruk <[EMAIL PROTECTED]> wrote:
> So, my configuration is the following:
> Python 2.5.1
> Server version: Apache/2.2.4 (FreeBSD)
> mod_python-3.3.1
update:
lxml-1.3.4
libxslt-1.1.21
libxml2-2.6.29
--
http://mail.python.org/mailman/listinfo/python-list
Dmitri Fedoruk wrote:
> def extApplyXslt(xslt, data, logger ):
> try:
> strXslt = urllib2.urlopen(xslt).read()
> # i have to read the xslt url to the python string
> except urllib2.HTTPError, e:
>...
> except urllib2.URLError, e:
>.
>
xcept Exception, exc:
logger.log(logging.CRITICAL, exc.__str__() )
try:
result_tree = transform(data)
return etree.tostring(result_tree, 'utf-8')
except Exception, exc:
print "xslt processing error!", exc.__str__()
return ""
It dies
ect has one code attribute,
.func_code I think. On the other hand, you should be able to attach other
code objects under different names, such as .func_code2. Such would,
however, be ignored in function calls.
| For example, will the following code ever create a
| list whose length is gr
I was playing around with the inspect module tonight, and I have a
question about "code components". Can an object have more than one
code component? For example, will the following code ever create a
list whose length is greater than one?
import inspect
# Some code here defining an object/functi
Duncan Booth wrote:
> Fuzzyman wrote:
[snip..]
>
> Does this do what you wanted? Instead of messing about with the code object
> just work out which values from the namespace the function actually
> expects.
>
> >>> def callfromnamespace(fn, namespace):
> names = fn.func_code.co_varnames[:fn.f
Simon Forman wrote:
> Fuzzyman wrote:
[snip..]
> > I was hoping I could get to the code object for the *body* of the
> > function. Looks like that won't be possible without dis-assembling the
> > bytecode or other tricks even more hackish than what I've already done.
> >
> > For the record, the co
Fuzzyman wrote:
>> I'd like to construct the code object so that it takes the parameters
>> from the enclosing scope (the context I pass into exec I guess),
>> without clobbering any local variables that may be defined in the code
>> object.
>>
>> Anyone got any clues ?
Does this do what you want
Fuzzyman wrote:
> Fuzzyman wrote:
> > Fuzzyman wrote:
> > > Hello all,
> > >
> > > I'm trying to extract the code object from a function, and exec it
> > > without explicitly passing parameters.
> > >
> > > The code object 'knows' it expects to receive paramaters. It's
> > > 'arg_count' attribute i
Fuzzyman wrote:
> Fuzzyman wrote:
> > Hello all,
> >
> > I'm trying to extract the code object from a function, and exec it
> > without explicitly passing parameters.
> >
> > The code object 'knows' it expects to receive paramaters. It's
> > 'arg_count' attribute is readonly.
> >
> > How can I set
Fuzzyman wrote:
> Hello all,
>
> I'm trying to extract the code object from a function, and exec it
> without explicitly passing parameters.
>
> The code object 'knows' it expects to receive paramaters. It's
> 'arg_count' attribute is readonly.
>
> How can I set the arg_count to 0, or pass paramet
Hello all,
I'm trying to extract the code object from a function, and exec it
without explicitly passing parameters.
The code object 'knows' it expects to receive paramaters. It's
'arg_count' attribute is readonly.
How can I set the arg_count to 0, or pass parameters to the code object
when I ex
On Sun, 29 Jan 2006 14:51:18 -0800, rumours say that Michael Spencer
<[EMAIL PROTECTED]> might have written:
>> http://www.effbot.org/librarybook/marshal.htm
>There's a typo in the text accompanying that example: img.get_magic() should
>be
>imp.get_magic().
The error is easy to explain: h
"Raymond Hettinger" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Fabiano Sidler wrote:
>> with pdb (which I'm surely not using as neatly as it could be). Or is
>> there any documentation on it I couldn't find?
>
> The pysassem module is part of the compiler package:
>
> http:
Fabiano Sidler wrote:
> 2006/1/29, Fabiano Sidler <[EMAIL PROTECTED]>:
> > 28 Jan 2006 22:02:45 -0800, Raymond Hettinger <[EMAIL PROTECTED]>:
> > > But if you want to make your life unnecessarily hard, you can hack the
> > > compiler module just upstream from the creation of the code object --
> >
2006/1/29, Fabiano Sidler <[EMAIL PROTECTED]>:
> 28 Jan 2006 22:02:45 -0800, Raymond Hettinger <[EMAIL PROTECTED]>:
> > But if you want to make your life unnecessarily hard, you can hack the
> > compiler module just upstream from the creation of the code object --
> > alter the newCodeObject() meth
Fredrik Lundh wrote:
> Fabiano Sidler wrote:
>
>> I'm looking for a way to compile python source to bytecode instead of
>> code-objects. Is there a possibility to do that? The reason is: I want
>> to store pure bytecode with no additional data.
>
> use ma
Fabiano Sidler wrote:
> I'm looking for a way to compile python source to bytecode instead of
> code-objects. Is there a possibility to do that? The reason is: I want
> to store pure bytecode with no additional data.
use marshal.
> The second question is, therefore: How can
[Fabiano Sidler]
> I'm looking for a way to compile python source to bytecode instead of
> code-objects. Is there a possibility to do that? The reason is: I want
> to store pure bytecode with no additional data.
>
> The second question is, therefore: How can I get the correct
Hi folks!
I'm looking for a way to compile python source to bytecode instead of
code-objects. Is there a possibility to do that? The reason is: I want
to store pure bytecode with no additional data.
The second question is, therefore: How can I get the correct values
for a given bytecode, su
Chinook wrote:
> When I create the code objects though, it seems a couple different ways
> work and I'm wondering which is better and why (or is there a more correct
> technique in this situation)?
from where are you getting the source code for those code objects?
from the exa
On Tue, 21 Jun 2005 09:56:27 -0400, Konstantin Veretennicov wrote
(in message <[EMAIL PROTECTED]>):
> On 6/21/05, Chinook <[EMAIL PROTECTED]> wrote:
>>
>> When I create the code objects though, it seems a couple different ways work
>> and I'm wondering which
On 6/21/05, Chinook <[EMAIL PROTECTED]> wrote:
>
> When I create the code objects though, it seems a couple different ways work
> and I'm wondering which is better and why (or is there a more correct
> technique in this situation)?
>
> The two different ways are illu
Using code objects?
===
As an OO exercise I have a factory pattern that returns class objects that
each have an "action" method. ClassObj.action() in turn returns a code
object in my recursive process loop.
I create the code objects as a one time step outside
28 matches
Mail list logo