Re: Is setdefaultencoding bad?

2011-02-23 Thread moerchendiser2k3
Ok, but that the interface handles UTF-8 strings
are still ok? The defaultencoding is still ascii.
-- 
http://mail.python.org/mailman/listinfo/python-list


Is setdefaultencoding bad?

2011-02-22 Thread moerchendiser2k3
Hi, I embedded Py2.6.1 in my app and I use UTF-8 encoded strings
everywhere in the interface, so the interface between my app and
Python is UTF-8 so I can simply write:

print u"\uC042"
print u"\uC042".encode("utf_8")

and get the corresponding chinese char in the console. But currently
sys.defaultencoding is still ascii. Should I change it in the site.py
and turn it to utf-8 or is this not recommended somehow? I often read
its highly unrecommended but I can't find an explanation why.

Thanks for any hints!!
Bye, moerchendiser2k3
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python leaks in cyclic garbage collection

2011-02-19 Thread moerchendiser2k3
Thanks for your answers! They really helped me out!! :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python leaks in cyclic garbage collection

2011-02-18 Thread moerchendiser2k3
Thanks a lot for any help!!!

Bye,
moerchendiser2k3
-- 
http://mail.python.org/mailman/listinfo/python-list


Python leaks in cyclic garbage collection

2011-02-18 Thread moerchendiser2k3
Hi, I have some problems with Python and the garbage collection. In
the following piece of code I create a simple gargabe collection but I
am still wondering why the finalizers are never called - at least on
exit of Py they should be called somehow. What do I miss here? I know,
there is no deterministic way how to resolve this though.

class Foo():

def __init__(self):
self.b=Bar(self)

def __del__(self):
print "Free Foo"

class Bar():
def __init__(self, f):
self.f=f

def __del__(self):
print "Free Bar"

f=Foo()
print f
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Resolve circular reference

2011-01-10 Thread moerchendiser2k3
On Jan 10, 7:18 pm, Stefan Behnel  wrote:
> moerchendiser2k3, 10.01.2011 18:55:
>
> >> If you can tell us why it's so important that the object be destroyed
> >> at that given time, even while a reference to it exists, maybe we can
> >> give you better suggestions.
>
> > Thanks for your answer! In my case the types A and B (in my example
> > above)
> > are a dialog and a dialog widget. At a special time I have to close
> > and
> > destroy all dialogs but this does not happen because the widget keeps
> > the dialog alive. I have the reference to the dialog
> > but after I closed the dialogs I also would like to destroy them
> > because they have to free some special ressources.
>
> Objects within a reference cycle will eventually get cleaned up, just not
> right away and not in a predictable order.
>
> If you need immediate cleanup, you should destroy the reference cycle
> yourself, e.g. by removing the widgets from the dialog when closing it.
>
> Stefan

The PyWidget type does not own the widget, it just points to it. I
have an
idea, would this fix the problem?

I destroy the internal dictionary of the dialog which points to other
PyObjects?
Then I would cut the dependency.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Resolve circular reference

2011-01-10 Thread moerchendiser2k3
> If you can tell us why it's so important that the object be destroyed
> at that given time, even while a reference to it exists, maybe we can
> give you better suggestions.

Thanks for your answer! In my case the types A and B (in my example
above)
are a dialog and a dialog widget. At a special time I have to close
and
destroy all dialogs but this does not happen because the widget keeps
the dialog alive. I have the reference to the dialog
but after I closed the dialogs I also would like to destroy them
because
they have to free some special ressources.

Thanks a lot!! Bye, moerchendiser2k3
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Resolve circular reference

2011-01-10 Thread moerchendiser2k3
so there is no chance without using weakrefs?
any ideas, tips, workarounds how I might handle this?

bye, moerchendiser2k3
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Resolve circular reference

2011-01-07 Thread moerchendiser2k3
> Force what?
> j refers to i, i refers to Foo, Foo refers to A. Therefore A should be
> alive.


Oh, sorry. Force the deletion of instance Foo(A) and Bar(B).
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Resolve circular reference

2011-01-07 Thread moerchendiser2k3
> Force what?
>
> j refers to i, i refers to Foo, Foo refers to A. Therefore A should be
> alive.

Oh, sorry. Force the deletion of A.
-- 
http://mail.python.org/mailman/listinfo/python-list


Resolve circular reference

2011-01-06 Thread moerchendiser2k3
Hi,

I have a small problem with circular references. I embedded Python
into my app and I have two types which are flagged with
Py_TPFLAGS_BASETYPE so I can inherit Python types from these types.
Lets call my C types A and B.


Here is the dependency:

class Foo(A):
e=Bar()

class Bar(B):
def __init__(self, p):
self.p=p
i=Foo()
j=Bar(i)

Everything works fine, the problem starts when I start to make a
circular reference in Python. In my embedded app I have a reference to
instance A. When I decref this reference its still alive because the
instance j(Bar) makes this object still alive. Is there any chance to
force this? Because without A the instance A shouldnt be alive
anymore. Thanks for any hint!!

Bye
-- 
http://mail.python.org/mailman/listinfo/python-list


Get frame object of last called function

2010-11-06 Thread moerchendiser2k3
Hi, is there any chance to get the frame object of the previous called
function?
I just find the 'f_back' frame object but this is the frame object of
the parent function,
not the previous one.

I try to get the line number of the exit point of the previous
function.


(0) def Test():
(1) print "OK"
(2) return "Foo"

p = Test()
#get the line number where Test() returned

Any ideas? Thanks a lot!

Bye, moerchendiser

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: The trouble with "dynamic attributes".

2010-09-16 Thread moerchendiser2k3
I am really sorry, but what are you talking about ? Hmmm, ...I have
problems to compile Python on SL, I did not ask anything about
"dynamic attribute". I don't get it...
-- 
http://mail.python.org/mailman/listinfo/python-list


compile Py2.6 on SL

2010-09-16 Thread moerchendiser2k3
Hi,

I have some trouble with Python on Snow Leopard (10.6.3). I compile
Python as a framework(for 32/64bit) without any problems.
But implementing the lib in my C app, I get the following error on
linking:

Undefined symbols:
  "_Py_InitModule4_64", referenced from:
  RegisterModule_BPY(char const*, PyMethodDef*, char const*,
_object*, int)in i_moduleobject.o
ld: symbol(s) not found

I read a lot of stuff about this problem, but nothing helped me. My
app is in 64-bit and I compiled Python for 32/64bit.
When I compile exactly the same package with the same configure flags
under Leopard (10.5.8) it works fine.
Any ideas?

Thanks a lot!

Bye, moerchendiser2k3
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Embedding Importing relative modules

2010-07-06 Thread moerchendiser2k3
Good idea. Just one thing I thought about:

Imagine I load them parallel so the GIL might
interrupt the save-process of sys.modules,

[ENSURE GIL]
Load Script
Save sys.modules
[interrupt]
Load Script
Save sys.modules
...

so this might run into several other problems.

But maybe I change that so I load the scripts in a row.
Thanks for your shoulder I can cry on ;)

Bye,

moerchendiser2k3
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Embedding Importing relative modules

2010-07-06 Thread moerchendiser2k3
>Set sys.path to include each script's base dir before running it, then
>restore after each script.

That works, but doesnt solve the problem.

ScriptA.py has a module in its directory called 'bar.py'
ScriptB.py has a module in its directory called 'bar.py'

Imagine the 'bar.py' modules dont have the same content, so
they are not equal.

Now when the first bar.py is imported, the second import for
a "import bar" imports the first one, because its already
stored in sys.modules.
-- 
http://mail.python.org/mailman/listinfo/python-list


Python Embedding Importing relative modules

2010-07-05 Thread moerchendiser2k3
Hi all,

I have a serious problem I haven't solved yet, hope one of you can
help me. The first thing is, I embedded Python into my app and I
execute several scripts in this environment.

The problem is, the scripts don't import modules from their relative
path. I guess this is related to the sys.path ['',...] and the current
working directory which is set to the directory of my host
application.

I could set that path manually, but all the scripts might be stored in
different locations. So now I try to find a way to handle that. Any
suggestions?

A solution would be, that each script, appends its own directory to
the system path, but this might lead to problems. Imagine all of them
have a module called 'foo.py' and its not the same. This might lead to
name conflicts, wouldnt it?

Btw, I found a source code line in the documentation, where I should
really get rid of the ['', ...] path in the system path due to
security reasons.

import sys; sys.path.pop(0)


Hope one of you can help me out here. Really thanks!!

Bye,

moerchendiser2k3
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Crash in PyThread_acquire_lock

2010-07-05 Thread moerchendiser2k3
Thanks Antoine! :) You were right. It was the wrong thread...uhmm...

Bye! :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Crash in PyThread_acquire_lock

2010-07-02 Thread moerchendiser2k3
Hi all,

I have a serious problem I want to solve. My app, where
Python is embedded crashs on OSX (10.6 SL). I can reproduce the crash
sometimes with a script that makes use of Python threads ( module:
threading).

'thelock->locked' is for sure still locked, but I can't identify the
problem.
Its just waiting, but it gets a 'EXC_BAD_ACCESS'. The line of the
crash
in PyThread_acquire_lock is the following one:

while ( thelock->locked ) {
status = pthread_cond_wait(&thelock->lock_released, &thelock-
>mut);  <<<<<<<<<<

>From the view of my code, I can exclude that the GIL was ensured but
not properly released
by PyStateGIL_Ensure and PyStateGIL_Release.

Any ideas how to get rid of this crash somehow? Thanks in advance!!

Bye, moerchendiser2k3

#0  0x7fff86c95316 in __semwait_signal ()
#1  0x7fff86c99131 in _pthread_cond_wait ()
#2  0x00011c89f8f4 in PyThread_acquire_lock (lock=0x1013803c0,
waitflag=1) at thread_pthread.h:452
#3  0x00011c84a414 in PyEval_RestoreThread (tstate=0x101380200) at
Python/ceval.c:334
#4  0x00011c889725 in PyGILState_Ensure () at Python/pystate.c:592

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Extract doc strings

2010-07-01 Thread moerchendiser2k3
Great! Thanks a lot!

This is what I was looking for. :)

Bye, moerchendiser2k3
-- 
http://mail.python.org/mailman/listinfo/python-list


tp_richcompare vs tp_compare

2010-07-01 Thread moerchendiser2k3
Hi all,

just another question. Can anyone explain me whats the real difference
between tp_richcompare and tp_compare? I read some stuff, but
sometimes I believe the author doesnt know either whats the real
difference or they forget it to explain. The Function definition looks
very similiar, except the one accepts POD types as return value, the
other wants the same for PyObjects.

Do I need to implement both? Looks very redundant, isnt it? Or is it
just an extension and tp_richcompare is the better choice here? Can
anyone please make the light on here? :)

Really thanks in advance for your help!!


Bye, moerchendiser2k3
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Extract doc strings

2010-07-01 Thread moerchendiser2k3
Hi ben,

thanks for your answer. Sure, __doc__ is the access point to the
docstring, but in this case, I just get the docstring of the code
object. So an explanation what a code object, but I need the docstring
of real docstring of the script.

bye, moerchendiser
-- 
http://mail.python.org/mailman/listinfo/python-list


Extract doc strings

2010-07-01 Thread moerchendiser2k3
Hi all,

when I have a PyCodeObject, is there any way to extract a doc string
from the code?
For instance the following script

<---script>
"""
Hello World!
"""
def main():
pass
main()


I would like to get "Hello World!". Any chance? Thanks in advance!!

Bye, moerchendiser2k3
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Mark built-in module as deprecated

2010-06-14 Thread moerchendiser2k3
Hi, yes, that was my first idea when I just create an
external module. I forgot something to say:

In my case the initfoo() function is called on startup
in my embedding environment, that means I call that
on startup of my main app.

Bye,
moerchendiser2k3
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Mark built-in module as deprecated

2010-06-13 Thread moerchendiser2k3
PyErr_WarnEx(PyExc_DeprecationWarning, "foo deprecated. use fuzz",
1);

But where can I write this? With Py_InitModule4 I can just
pass a list of functions but no real execution part which
is executed when a module is imported.
-- 
http://mail.python.org/mailman/listinfo/python-list


Mark built-in module as deprecated

2010-06-13 Thread moerchendiser2k3
Hi,

can anyone give me a hint how to mark a built-in module as deprecated?
So mark via warnings... I create a module with Py_InitModule4.

Thanks in advance!!

Bye, moerchendiser2k3
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Py_single_input and the side-effects...

2010-06-06 Thread moerchendiser2k3
thx, thats it! :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Py_single_input and the side-effects...

2010-05-31 Thread moerchendiser2k3
Hi Carl,

you are right, Python still holds the last
reference. I just set a dummy and thats it :)

Can you tell me where did you get the information from?

Thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Py_single_input and the side-effects...

2010-05-31 Thread moerchendiser2k3
Hi Carl,

thanks for your help!!

> The only foolproof way to ensure that an object has been finalized is
> to do it manually (i.e., provide a finalize method to releases
> resources).

Yes, you are right, thats what I thought, too. So I wanted to
manually delete the reference, but browsing the sources, seems that
I cant really free it, because its wrapped somewhere
in Py_Finalize() and PyGC_Collect and Py_FreeModules. Any ideas?

Thanks a lot!

Cheers, moerchendiser2k3
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Py_single_input and the side-effects...

2010-05-30 Thread moerchendiser2k3
Hi, any idea?
-- 
http://mail.python.org/mailman/listinfo/python-list


Py_single_input and the side-effects...

2010-05-29 Thread moerchendiser2k3
Hi at all,

I have a small problem with Py_single_input, that I dont really know
what it
actually does.

I created my own interactive interpreter loop and when I create
objects like

p = TestObject()

this instance is just deleted on Py_Finalize() even I delete the
entire console scope long time before. It seems that Py_single_input
stores the references somewhere else. Could anyone explain me a little
bit what is actually going on here?

Thanks a lot!
Cheers, moerchendiser2k3
-- 
http://mail.python.org/mailman/listinfo/python-list


buffer objects (C-API)

2010-05-12 Thread moerchendiser2k3
Hi at all,

is it possible that a buffer object deallocates the memory when the
object is destroyed? I want to wrap the buffer object around some
memory. Or is there any chance that the buffer object copies the
memory so it will be responsible when it will be destroyed?

Thanks in advance, bye.

moerchendiser2k3
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: INCREF DECREF manually

2010-05-10 Thread moerchendiser2k3

Do to some debugging if a version contains a bug and needs to be fixed
there manually.
-- 
http://mail.python.org/mailman/listinfo/python-list


INCREF DECREF manually

2010-05-10 Thread moerchendiser2k3
Hi,

just a small question. Is it possible to change the refcount of a
reference manually? For debugging / ...

Thanks!

moerchendiser2k3
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Embedding, no correct lib

2010-05-05 Thread moerchendiser2k3
On 6 Mai, 01:30, "Gabriel Genellina"  wrote:
> En Wed, 05 May 2010 09:04:06 -0300, moerchendiser2k3  
>  escribió:
>
> > I have a serious problem with Python. I am currently trying to
> > implement Python into my app.
> > Well this works fine, but get this:
>
> > I have my own Python interpreter in a subfolder of my app. When I
> > start my app, PYTHONHOME is set, and an environment variable is set to
> > it can find the python DLL on startup.
>
> You should not define any environment variables.
>
> You are embedding Python into your application, aren't you? That is, you  
> call Py_Initialize and all that stuff - you don't invoke a separate  
> python.exe, true?
>
> Python tries to find its standard library looking for
> [the directory containing the executable]\Lib\os.py
> and a few other places. Once it finds the "Lib" directory, all other are  
> derived from it.
>
> > When Python is not installed on the system everything works fine as
> > expected.
>
> > When I now install Python on my system (so I have two python libs now)
> > the system installation is the preferred one.
>
> > print sys.path prints out ['', 'C:\Windows
> > \system32\python26.zip', ...] and I cant explain whats going wrong
> > here.
>
> Such zip file doesn't even exist in a standard Python installation; but it  
> means that your program loaded python26.dll from the system32 directory,  
> not your own copy. You may want to use a .local file or a manifest; 
> seehttp://msdn.microsoft.com/en-us/library/ms811694.aspx
>
> > I expected that it just uses the System lib when it cannot find
> > it in the subfolder which I set in the environment variables
> > before.. :-(
>
> Note that this is a Windows issue, not a Python one. You have to ensure  
> the Python DLL is loaded from your own directory, not the system one.
>
> (BTW, don't set any environment variables. There is no need to do so, and  
> it may conflict with an existing installation. The reverse is true too: a  
> PYTHONPATH variable set for the "system" Python will interfere with your  
> private copy too. Global state is always a bad idea.)
>
> --
> Gabriel Genellina

Hi Gabriel, thanks very much for your information. I found the
solution.
This is related to this one. The order of the search path is the
explanation
why the system one is used:

http://msdn.microsoft.com/en-us/library/ms682586(VS.85).aspx

So 'Alternate Search Order' is the solution. :)

Bye, moerchendiser2k3
-- 
http://mail.python.org/mailman/listinfo/python-list


Python Embedding, no correct lib

2010-05-05 Thread moerchendiser2k3
Hi,

I have a serious problem with Python. I am currently trying to
implement Python into my app.
Well this works fine, but get this:

I have my own Python interpreter in a subfolder of my app. When I
start my app, PYTHONHOME is set, and an environment variable is set to
it can find the python DLL on startup.

When Python is not installed on the system everything works fine as
expected.

When I now install Python on my system (so I have two python libs now)
the system installation is the preferred one.

print sys.path prints out ['', 'C:\Windows
\system32\python26.zip', ...] and I cant explain whats going wrong
here. I expected that it just uses the System lib when it cannot find
it in the subfolder which I set in the environment variables
before.. :-(

Any ideas? Thanks a lot for help.

Bye, moerchendiser2k3
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Windows installer of Python

2010-04-15 Thread moerchendiser2k3
Hm, I thought there will be installed something
like the Microsoft Redistributable 2008 Package to make Python run?
-- 
http://mail.python.org/mailman/listinfo/python-list


Windows installer of Python

2010-04-14 Thread moerchendiser2k3
Hi,

can anyone tell me where to find information which files
are installed by the Python installer on Windows?

I am looking for some special files but
dont know how to catch them.

Thanks!!

moerchendiser2k3
-- 
http://mail.python.org/mailman/listinfo/python-list


C-API: Extract information from function object

2010-03-24 Thread moerchendiser2k3
Hi,

I have a reference to a function and would like to know how to extract
information from a function object.

Information I am looking for: line and file where this function is
from.

PyObject_Call can do this to when I call a function object and
something failed so these information are written to the traceback. So
any suggestions how to do that?

Thx!! moerchendiser2k3
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: C-API PyObject_Call

2010-03-19 Thread moerchendiser2k3
Yes, the user is able to set a file which contains a function that
does what the user wants.
But in a case, I expect a special return value of this function.

So, I need to tell him, in which file/line the error occured,
otherwise he dont know
where to look.

Imagine he set 20 files, and all of them have implemented a special
function. So he
wouldnt know where to check for the error.

Bye, moerchendiser2k3
-- 
http://mail.python.org/mailman/listinfo/python-list


Simple lock

2010-03-19 Thread moerchendiser2k3
Hi,

I have a common question about locks:

class SetPointer
{
private:
void *ptr;

MY_LOCK lock;


public:
void SetPointer(void *p)
{
Lock(this->lock);
this->ptr = p;
}

void *GetPointer()
{
Lock(this->lock);
return this->ptr;
}
};


Just a question, is this lock redundant, when the Pointer can be set/
get from different threads?
Thanks a lot!! Bye, moerchendiser2k3
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: C-API PyObject_Call

2010-03-19 Thread moerchendiser2k3
In my case I call a funcion and I would like to get the line
where the function returned.

for instance:


def my_function():
return 3

So I would like to get line 2(in C) somehow.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: C-API PyObject_Call

2010-03-18 Thread moerchendiser2k3
> Funny that you (being the OP) ask *me* what kind of line information *you*
> want.
>
> Stefan

Well, I need the line/file information of Python :
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: C-API PyObject_Call

2010-03-17 Thread moerchendiser2k3
> 1) put the line number information into the message string when you raise
> the exception


you mean the line and file information of the C code, right?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: C-API PyObject_Call

2010-03-16 Thread moerchendiser2k3
At first thanks for your answers!!!

On 16 Mrz., 21:16, Carl Banks  wrote:
> Here you raise an exception with a C statement,
> and catch and print it in the very next line.  The exception doesn't
> exit from Python code so there are no lines to print.

Exactly, I dont expect any line/file information. I am just looking
forward for a solution how to solve that. I would like to avoid
the use of the debugger in this case.

My ideas:

1. I thought the return value might contain any information where it
is from.
2. Otherwise it would be cool if there are any information available
in which line, file
the last called function/method exited.

Bye, moerchendiser2k3
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: C-API PyObject_Call

2010-03-16 Thread moerchendiser2k3
Hi, currently I am not at home, I will post some stuff when I am back.
Just the note: I throw an exception with the C API.

Looks like that


PyObject *result = PyObject_Call(my_isntance, "", NULL);
if(result==NULL)
{
PyErr_Print(); //when this happens, the traceback is correct with
information about the file/line
return;
}

if(!PyXYZ_Check(result))
{
PyErr_SetString(PyExc_TypeError, "Wrong type, ");
PyErr_Print(); //missing information of the file/line.
return;
}

Well, I expect, that there are no information about the line/file, so
I know something is missing, but what is missing?

Bye, moerchendiser2k3
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: C-API PyObject_Call

2010-03-16 Thread moerchendiser2k3
In one case I have to check the return value of PyObject_Call, and if
its not of the correct return value,
I throw an exception, but I just get a simple output:

TypeError: Expected an instance of XYZ, no int.

instead of

Traceback (most called...)
TypeError: in line 3, file test.py: expected an instance of XYZ, no
int...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: C-API PyObject_Call

2010-03-16 Thread moerchendiser2k3
But the stack is empty after PyObject_Call, isnt it?
-- 
http://mail.python.org/mailman/listinfo/python-list


C-API PyObject_Call

2010-03-16 Thread moerchendiser2k3
Hi,

i have a serious problem and I am looking for a solution. I pass an
instance of a class from a file to PyObject_Call. When something
fails, I get a full traceback. If it succeeds, I get the return value.

Is it possible to get information from which line/file the return
value of PyObject_Call is?

Thanks!!

moerchendiser2k3
-- 
http://mail.python.org/mailman/listinfo/python-list


Build Python with XCode

2010-03-15 Thread moerchendiser2k3
Hi,

I would like to build Python with Xcode (but without the makefile).
Does anyone know a link where I can get a real xcodeproj with the
current Py2.x sources?


Thanks in advance!! Bye, donnerCobra
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: time_struct

2010-03-07 Thread moerchendiser2k3
any ideas?
-- 
http://mail.python.org/mailman/listinfo/python-list


time_struct

2010-03-07 Thread moerchendiser2k3
Hi,

can anyone tell me how to return a time_struct from the timemodule in
my own C-Module?
Is that possible? I can just find one function in timefuncs.h, but it
doesnt return any PyObject.

Thanks in advance.

moerchendiser2k3
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: C-API: Get scope in function

2010-01-18 Thread moerchendiser2k3
Perfect, this helped me a lot, thx! :)
-- 
http://mail.python.org/mailman/listinfo/python-list


C-API: Get scope in function

2010-01-17 Thread moerchendiser2k3
Hi,

I have a small problem how to get the scope from a C-API function.
Check out this code snippet:

[code]
variable = 3

def test():
print variable #output: 3
print globals() # ... 'variable': 3, ...

test()
[/code


In my case I know there is a variable in the scope where this function
is called from, but I dont know how to get it.
Check out:

[code]
PyObject *MyFunction_Test(PyObject* self, PyObject *args, PyObject
*keywords)
{
 ... ?
}
[/code]

Is it possible to get the dictionary of the scope where this function
is called from?


Thanks a lot!!

Bye, googler
-- 
http://mail.python.org/mailman/listinfo/python-list


Freetype2 in PIL

2009-07-24 Thread moerchendiser2k3
Hi,

I have a problem with Freetype2 in the Python Image Library. I
compiled it as 64bit and I got a file named freetype239.lib. So I
added this file to a folder called lib. I added the parent folder of
the lib folder to the setup.py settings (like all the others: libjpeg,
zlib). LIbjpeg and Zlib works fine on Windows 64 bit and the installer
can find them.

But I just get a "Freetype2 not found". Even renaming it to
freetype.lib and freetype2.lib doesnt work.


Any suggestions why PIL cant find the library?

Bye and thanks in advance :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Freetype2 in PIL

2009-07-24 Thread moerchendiser2k3
Hi,

I have a problem with Freetype2 in the Python Image Library. I
compiled it as 64bit and I got a file named freetype239.lib. So I
added this file to a folder called lib. I added the parent folder of
the lib folder to the setup.py settings (like all the others: libjpeg,
zlib). LIbjpeg and Zlib works fine on Windows 64 bit and the installer
can find them.

But I just get a "Freetype2 not found". Even renaming it to
freetype.lib and freetype2.lib doesnt work.


Any suggestions why PIL cant find the library?

Bye and thanks in advance :)
-- 
http://mail.python.org/mailman/listinfo/python-list


PIL for OSX 64bit

2009-07-21 Thread moerchendiser2k3
Hi,

I have a problem with Python and the Python Image Library to get it
work on OSX 64 bit. Maybe anyone can help me? I started Python in 64
bit mode and called Image.open(...).load() and got:

ImportError: The _imaging C module is not installed

Yes, it seems PIL is not available in 64 bit on my system, but I can't
compile it in any way. Is there a tutorial or something like that
which explains how I can compile it in 64 bit? I found a workaround
where I added this function to the setup.py

OrigExtension = Extension
def Extension(*args, **kwargs):
extra_args = ['-arch', 'x86_64']
kwargs['extra_compile_args'] = extra_args + kwargs.get
('extra_compile_args', [])
kwargs['extra_link_args'] = extra_args + kwargs.get('extra_link_args',
[])
return OrigExtension(*args, **kwargs)

without success. Can anyone help me? Thanks...


Cheers, Googler
-- 
http://mail.python.org/mailman/listinfo/python-list