PyRun_SimpleString no sys.argv[0]

2006-12-06 Thread iwl
Hello,

I'm just starting with Python - would like to embed it in my
windows-programm as an script-processor. For tests I use easygui some
easy-wrapper for the py-tck-stuff.

 PyRun_SimpleString("from easygui import *\n");
 PyRun_SimpleString("import sys\n");
 PyRun_SimpleString("msgbox()\n");

Traceback (most recent call last):
  File "", line 1, in 
  File "easygui.py", line 148, in msgbox
reply = buttonbox(message, title, choices)
  File "easygui.py", line 170, in buttonbox
root = Tk()
  File "C:\Python\Python25\Lib\lib-tk\Tkinter.py", line 1631, in
__init__
baseName = os.path.basename(sys.argv[0])
AttributeError: 'module' object has no attribute 'argv'

May bee makes some sence that the embedded Interpreter has no argv[0],
however tk seems not to bee ready for that.
I try to define some sys.argv[0] myself after I get out how to do that,
maybee someone other has an better idea until than.

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


Embedded python adding variables linking to C++-Variables / callbacks

2006-12-07 Thread iwl
Hello,

I would like to add Variables to my embedded python which represents
variables from my
C++-Programm.
I found C-Api-funcs for adding my C-Funcs to python but none to add
variables.
I would like some C-Function is called when the added Python-varible is
set (LValue) and
some other when it is read (RValue). Can I do this.
May be I have to do this in python and call the C-Funcs from a python
callback.

May be somebody can give short hints what to look for.

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


Re: Embedded python adding variables linking to C++-Variables / callbacks

2006-12-07 Thread iwl

[EMAIL PROTECTED] schrieb:
>
> Write some C functions -callable from Python- which will be used to get
> and set the variable value.
> >From inside Python, declare a property with getter and setter which
> will call your C functions.
> This works fine for object attributes. If you want to trap references
> to local or global "variables", I think you could provide customized
> dictionaries for locals and globals, but I'm not sure if it works
> really.
>
Thank you I will try this.
What I found out up to now is to create a class inherited from an
fitting type
and overwrite the __setitem__ and __getitem__ method but haven't test
this
yet, something like that:

class test(int):
 __setitem(self, value)__:  C-Set-Func(value)
 __getitem(self)__: return C-Get-Func()

x=test()
x= -> C-Set-Func called
y=x -> C-Get-Func called

something seems not yet correct

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


funcs without () like print

2006-12-07 Thread iwl
Hello can I make funktions callable without () like print
at time the interpreter seems to printout the adres when I type the
function without ()

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


Using Py_InitModule3 -> [Linker Error] Unresolved external '_Py_InitModule4TraceRefs'

2006-12-08 Thread iwl
Hello

I copied the code from the Extending Embedded Python section in the
Python 2.5 but get an linker Error Unresolved external
_Py_InitModule4TraceRefs.
Who knows what's wrong?

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


Re: Using Py_InitModule3 -> [Linker Error] Unresolved external '_Py_InitModule4TraceRefs'

2006-12-09 Thread iwl

Fredrik Lundh schrieb:
>
> you've mixed components compiled with Py_TRACE_REFS with components that
> aren't compiled with Py_TRACE_REFS.  don't do that.
>
H'm does this mean I have to write something like
#define Py_TRACE_REFS
befor I include 

> (what is it with you C programmers these days, btw?  have they stopped
> teaching how to how use "grep" and library inspection tools when they
> teach C and C++ ?)
>
I'm afraid so - I haven't teach me anything about grep yet.

I just downloaded the Phyton 2.5 Windows-Installer including C-Libs and

Headers and include  and linked Python25.lib after some
conversion needed for Borland C++ Builder 6 und tryed the embedded
Demo. In the Phyton module include file I red something that this
happens 
when size_t_size != sizeof_int.

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


PyThreadState_SetAsyncExc (nThreadId ??????, exc);

2006-12-14 Thread iwl
what is the nThreadId-Parameter of PyThreadState_SetAsyncExc?

I try to implement a Terminate-Button in my C-Prog for my
embedded Python, but its hard to find an example how to
stop an interpreter running in an thread.

I found no other Python C-App-Func returning such a parameter.

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


askstring Window to the top under Windows

2007-03-06 Thread iwl
Hi,

I tryed askstring to input some text in my script,
but some ugly empty Window appears with the
Input-Window behind and all together behind my
Console showing my script. So all have to brought
to the top first by the user - very unconfortable

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


Re: askstring Window to the top under Windows

2007-03-06 Thread iwl
On 6 Mrz., 14:48, "Tim Golden" <[EMAIL PROTECTED]> wrote:
> On Mar 6, 1:13 pm, "iwl" <[EMAIL PROTECTED]> wrote:
>
> It's not clear whether you're talking about the usual
> "Why do I get a DOS window when I run my python script?"
> question -- to which the answer is, in essence, change
> your script's extension to .pyw or use the pythonw.exe
> executable -- or "Why _when I use askstring_ do I get
> an empty window?". If it's the latter, then I don't
> know, but can you provide a small example script which
> exhibits the behaviour.
>
> TJG

>>> import tkSimpleDialog
>>> tkSimpleDialog.askstring("a","b")

at the python Console under XP (not pythonw).

-> instead of only showing the Inputwindow at the top,
some additional empty window is shown, both not on top.

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


Re: askstring Window to the top under Windows

2007-03-07 Thread iwl
On 7 Mrz., 02:49, jim-on-linux <[EMAIL PROTECTED]> wrote:
> On Tuesday 06 March 2007 08:13, iwl wrote:
>
> > Hi,
>
> > I tryed askstring to input some text in my
> > script, but some ugly empty Window appears with
> > the Input-Window behind and all together behind
> > my Console showing my script. So all have to
> > brought to the top first by the user - very
> > unconfortable
>
> By default
> tk will open a root window.

Is this default changeable befor askstring?

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


BUG?: Saving empty array in shelve

2007-04-02 Thread iwl
Hi,

I've tryed to save some data containing empty arrays (array('f')) in a
shelve.
It looks like the shelve has some problems with empty arrays, get
allways:
TypeError: ("'NoneType' object is not iterable", ,
('f', None))-
Messages when dealing with the readed back shelve.
Seems like I have to avoid empty arrays in a shelve.

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


no trace of PyRun_SimpleString() ???

2007-04-18 Thread iwl
Hi,

it seems like I can't trace scripts run by PyRun_SimpleString():

a=0
def test(frame, event, arg):
 global a
 a+=1

import sys
sys.settrace(test)
print a
print a
print a

->
0
0
0

Does anybody know how I can get something similar with the
C-Funcs for Tracing??

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


predefined empty base class ??

2007-01-17 Thread iwl
Hi,

is there an predefined empty base class
which I can instanziate to have an 
container i can copy attributes in?

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


Creating arrays (builtin) in C Extensions

2007-02-28 Thread iwl
Hello,

there is an builtin documented array module in phyton,
but no documentation how such an array can be
created in C-Extension functions.
So I have to use Lists at time, but this is I think
inefficient with large data sets.

Is there some interface aviable which I can link to my
Programm without any change to standard python?

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