Re: unable to run the basic Embedded Python example

2023-06-26 Thread Christian Gollwitzer via Python-list
Hi Dave, I can tell you where the error comes from, but I don't know how to fix it correctly: Am 24.06.23 um 19:29 schrieb Dave Ohlsson: 9. And now, when I ran embedded_python.exe: 20:14:06: Starting C:\temp\build-embedded_python-Desktop_Qt_6_1_3_MSVC2019_64bit-Debug\debug\embedded_python.ex

Re: unable to run the basic Embedded Python example

2023-06-24 Thread Fulian Wang via Python-list
_ From: Fulian Wang Sent: Saturday, June 24, 2023 7:43:56 PM To: Dave Ohlsson ; python-list@python.org Subject: Re: unable to run the basic Embedded Python example I study computer science in byu.edu, we choose the 3.4.3 vision. No matter which kind of computers or windows, I needed to download i

Re: unable to run the basic Embedded Python example

2023-06-24 Thread Fulian Wang via Python-list
Python-list on behalf of Dave Ohlsson via Python-list Sent: Saturday, June 24, 2023 15:35 To: python-list@python.org Subject: unable to run the basic Embedded Python example I cannot get the simple program https://docs.python.org/3/extending/embedding.html#very-high-level-embedding to wor

unable to run the basic Embedded Python example

2023-06-24 Thread Dave Ohlsson via Python-list
I cannot get the simple program https://docs.python.org/3/extending/embedding.html#very-high-level-embedding to work. My environment: * Windows 10 * Microsoft Visual Studio 2019 * Qt Creator 10.0.1 (only as an IDE) * Python not installed This is what I did: 1. I downloaded https://www.python.org

Re: Embedded python is not 100% stable

2023-04-13 Thread aapost
On 4/13/23 03:40, Guenther Sohler wrote: Attachments are stripped, so they weren't included. Glancing at the branch and the 2 lines you mentioned. You have a comment with a link for python 2.3 documentation. Yet you have python 3.10 code included elsewhere (and openscad itself requires the

Re: Embedded python is not 100% stable

2023-04-13 Thread Dieter Maurer
Guenther Sohler wrote at 2023-4-13 09:40 +0200: > ... >I have been working on adding embedded python into OpenSCAD ( >www.openscad.org) >for some time already. For that i coded/added an additional Python Type >Object >which means to hold openscad geometric data. > >

Embedded python is not 100% stable

2023-04-13 Thread Guenther Sohler
Hi Python LIst, I have been working on adding embedded python into OpenSCAD ( www.openscad.org) for some time already. For that i coded/added an additional Python Type Object which means to hold openscad geometric data. It works quite well but unfortunately its not 100% stable and i have been

Re: Embedded python: How to debug code in an isolated way

2020-08-26 Thread Barry Scott
> On 24 Aug 2020, at 12:52, Eko palypse wrote: > > Thank you very much for your interest in my little problem. > >> When the app calls into python does the event loop of the gui block? > > Yes, the cpp app calls a callback function from the embedded python >

Re: Embedded python: How to debug code in an isolated way

2020-08-24 Thread Chris Angelico
On Tue, Aug 25, 2020 at 6:30 AM Schachner, Joseph wrote: > > Another suggestion: If your Python code only references few things outside > of itself, make a simulated environment in Python on your PC, so that you can > run your embedded code after importing your simulated environment, which >

RE: Embedded python: How to debug code in an isolated way

2020-08-24 Thread Schachner, Joseph
n.org Subject: Re: Embedded python: How to debug code in an isolated way On 2020-08-22, Chris Angelico wrote: > On Sun, Aug 23, 2020 at 5:51 AM Eko palypse wrote: >> So the question is, what do I need to read/learn/understand in order to >> solve this issue? >> Or in other

Re: Embedded python: How to debug code in an isolated way

2020-08-24 Thread Eko palypse
Thank you very much for your interest in my little problem. > When the app calls into python does the event loop of the gui block? Yes, the cpp app calls a callback function from the embedded python interpreter synchronously. > When you print does that trigger the event loop to run in a

Re: Embedded python: How to debug code in an isolated way

2020-08-23 Thread Grant Edwards
On 2020-08-23, Chris Angelico wrote: > On Mon, Aug 24, 2020 at 6:00 AM Grant Edwards > wrote: >> >> On 2020-08-22, Chris Angelico wrote: >> > On Sun, Aug 23, 2020 at 5:51 AM Eko palypse wrote: >> >> So the question is, what do I need to read/learn/understand in order to >> >> solve this issue

Re: Embedded python: How to debug code in an isolated way

2020-08-23 Thread Barry
> On 22 Aug 2020, at 20:53, Eko palypse wrote: > > Hello, > > background info first. On windows, python3.8.5 > > A cpp app has an embedded python interpreter which allows to modify/enhance > the cpp app > by providing objects to manipulate the cpp app and cal

Re: Embedded python: How to debug code in an isolated way

2020-08-23 Thread Chris Angelico
On Mon, Aug 24, 2020 at 6:00 AM Grant Edwards wrote: > > On 2020-08-22, Chris Angelico wrote: > > On Sun, Aug 23, 2020 at 5:51 AM Eko palypse wrote: > >> So the question is, what do I need to read/learn/understand in order to > >> solve this issue? > >> Or in other words, how can I debug my scr

Re: Embedded python: How to debug code in an isolated way

2020-08-23 Thread Grant Edwards
On 2020-08-22, Chris Angelico wrote: > On Sun, Aug 23, 2020 at 5:51 AM Eko palypse wrote: >> So the question is, what do I need to read/learn/understand in order to >> solve this issue? >> Or in other words, how can I debug my script in an isolated environment. > > I'd go for the old standby - I

Re: Embedded python: How to debug code in an isolated way

2020-08-22 Thread Eko palypse
Thx for your tip/suggestion. > If In Doubt, Print It Out! That's the current situation and that's usually enough, but then there's this situation where it gets annoying because you realize that the print wouldn't make more sense at this point but at that point and that's where a debugger is just

Re: Embedded python: How to debug code in an isolated way

2020-08-22 Thread Chris Angelico
On Sun, Aug 23, 2020 at 5:51 AM Eko palypse wrote: > So the question is, what do I need to read/learn/understand in order to solve > this issue? > Or in other words, how can I debug my script in an isolated environment. I'd go for the old standby - IIDPIO: If In Doubt, Print It Out! Instead of t

Embedded python: How to debug code in an isolated way

2020-08-22 Thread Eko palypse
Hello, background info first. On windows, python3.8.5 A cpp app has an embedded python interpreter which allows to modify/enhance the cpp app by providing objects to manipulate the cpp app and callbacks to act on certain events, like fileopen, fileclose, updateui ... which are send by the cpp

Re: Threading module and embedded python

2020-04-16 Thread Eko palypse
fee7fc17e3()_ctypes.pyd!07fee7fbfee3()_ctypes.pyd!07fee7fbb4c5()_ctypes.pyd!07fee7fbc019()_ctypes.pyd!07fee7fb6dfa()python37.dll!_PyObject_FastCallKeywords(_object > > * callable=0x02fa8c78, _object * const * > stack=0x05261c78, > > __int64 nargs=5, _object * k

Re: Threading module and embedded python

2020-04-16 Thread Barry Scott
dialog that allows it be seen. Test the dialog code outside of the embedded python, with a command line python. I recall that you have to pass in the parent for a dialog. Maybe in the embedded version you do not have an HWND that is usable, can NULL be used? Is there a SHOW arg that you need to p

Re: Threading module and embedded python

2020-04-16 Thread Eko palypse
e. > >>> > >>> If I start a Python script in my plugin which uses the threading module > >>> I can verify via ProcessExplorer that the thread is started, > >>> but it doesn't do anything (??) and the c++ application doesn't really > &

Re: Threading module and embedded python

2020-04-15 Thread Barry
verify via ProcessExplorer that the thread is started, >>> but it doesn't do anything (??) and the c++ application doesn't really >> do anything anymore either. >>> >>> Only when I stop the C++ Applikation, the thread becomes active for a >> short time. >

Re: Threading module and embedded python

2020-04-15 Thread Eko palypse
started, > > but it doesn't do anything (??) and the c++ application doesn't really > do anything anymore either. > > > > Only when I stop the C++ Applikation, the thread becomes active for a > short time. > > Verified with logging module over time print-outs. &

Re: Threading module and embedded python

2020-04-15 Thread Barry Scott
stop the C++ Applikation, the thread becomes active for a short > time. > Verified with logging module over time print-outs. > > Apparently I did not understand everything about threads and embedded python. > > Any idea what I'm doing wrong? This is what I typically do.

Threading module and embedded python

2020-04-15 Thread Eko palypse
parently I did not understand everything about threads and embedded python. Any idea what I'm doing wrong? The whole thing is initialized by the DllMain routine. BOOL APIENTRY DllMain( HANDLE hModule, DWORD reasonForCall, LPVOI

Re: Using exec with embedded python interpreter 3.7

2019-09-02 Thread Eko palypse
@MRAB, I'm building a notepad++ plugin which can execute the written code and if one writes help(os) it gets executed via exec(editor.getText()) and output redirected to the plugin console window. Sorry to you as well as I have also replied to you directly. Thank you -- https://mail.python.org/mai

Re: Using exec with embedded python interpreter 3.7

2019-09-02 Thread Eko palypse
Just saw, that I replied to you directly instead to python list, sorry. That did it, changed encoding from function to property and now I'm able to call help(object) Thank you. -- https://mail.python.org/mailman/listinfo/python-list

Re: Using exec with embedded python interpreter 3.7

2019-09-01 Thread MRAB
On 2019-08-31 13:16, Eko palypse wrote: I've already sent this through mail yesterday but it doesn't appear here, maybe because of the help word in the content. Please execute in case it appears a second time. Hello, I'm creating a notepad++ plugin which hosts an embedded pyt

Re: Using exec with embedded python interpreter 3.7

2019-09-01 Thread Peter Otten
Eko palypse wrote: > I've already sent this through mail yesterday but it doesn't appear here, > maybe because of the help word in the content. Please execute in case it > appears a second time. > > > Hello, > I'm creating a notepad++ plugin which hosts an em

Using exec with embedded python interpreter 3.7

2019-09-01 Thread Eko palypse
I've already sent this through mail yesterday but it doesn't appear here, maybe because of the help word in the content. Please execute in case it appears a second time. Hello, I'm creating a notepad++ plugin which hosts an embedded python interpreter by using cffi to build the

Using exec with embedded python interpreter 3.7

2019-09-01 Thread Eko palypse
Hello, I'm creating a notepad++ plugin which hosts an embedded python interpreter by using cffi to build the dll. So far so good. One obstacle I've found is that I'm not able to use exec(help(object)) in order to get the wanted info from the object. The error I get is: Traceba

Re: Embedded Python and multiprocessing on Windows?

2018-08-10 Thread applemask
On Friday, August 10, 2018 at 2:28:45 AM UTC-4, Léo El Amri wrote: > That may be something simple: Did you actually protected the entry-point > of your Python script with if __name__ == '__main__': ? That was my first thought too; the script technically doesn't have top-level code, so I figured I

Re: Embedded Python and multiprocessing on Windows?

2018-08-09 Thread Léo El Amri via Python-list
On 09/08/2018 19:33, Apple wrote:> So my program runs one script file, and multiprocessing commands from that script file seem to fail to spawn new processes. > > However, if that script file calls a function in a separate script file that > it has imported, and that function calls multiprocessin

Re: Problems with imports on multiple threads, with embedded Python

2018-01-04 Thread dieter
geoff.ba...@gmail.com writes: > I have a multithreaded application using an embedded Python 3.6.4 (upgraded > from 3.6.2 today in the hope that the problem was now solved: it doesn't seem > to be). The standard library is in a zip file. So long as only one thread is > running

Re: Problems with imports on multiple threads, with embedded Python

2017-12-21 Thread geoff . bache
On Thursday, 21 December 2017 00:33:54 UTC+1, Lawrence D’Oliveiro wrote: > On Thursday, December 21, 2017 at 5:13:33 AM UTC+13, geoff...@gmail.com wrote: > > > > I have a multithreaded application using an embedded Python 3.6.4 ... > > Avoid multithreading if you can. Is

Problems with imports on multiple threads, with embedded Python

2017-12-20 Thread geoff . bache
Hi all, I have a multithreaded application using an embedded Python 3.6.4 (upgraded from 3.6.2 today in the hope that the problem was now solved: it doesn't seem to be). The standard library is in a zip file. So long as only one thread is running Python at a time it seems to work fine

Re: Embedded Python import fails with zip/egg files (v3.6.1)

2017-05-15 Thread Griebel, Herbert
Thanks eryk! It looks like I have to dig deeper and step through the Python code again to see what's going on. On 11.05.2017 15:37, eryk sun wrote: On Thu, May 11, 2017 at 9:02 PM, Griebel, Herbert wrote: 07:59:04,3205458python.exe4224CreateFile C:\Users\hansi\Downloads\python-e

Re: Embedded Python import fails with zip/egg files (v3.6.1)

2017-05-11 Thread eryk sun
On Thu, May 11, 2017 at 9:02 PM, Griebel, Herbert wrote: > > 07:59:04,3205458python.exe4224CreateFile > C:\Users\hansi\Downloads\python-emb\python36.zipSUCCESS Desired Access: > Read Attributes, Synchronize, Disposition: Open, Options: Synchronous IO > Non-Alert, Open Reparse Point

Embedded Python import fails with zip/egg files (v3.6.1)

2017-05-11 Thread Griebel, Herbert
Hello, I am having trouble importing python modules on certain machines. On some machines import works, on some not (all machines are Win7 64bit). Python is not installed on any of these machines but used embedded. I tried to analyze the problem but did not succeed so here is what I found. Fi

How to pass C++ function pointer argument in embedded python environment?

2016-11-04 Thread xzldyx
arg2 and I just need call a function like follow and it worked a(arg1,arg2,progress_callback = pro_call) question: I don't know how to do like the former exam in embedded python environment. thank you for your reading ,thanks for any response! -- https://mail.python.or

Re: Can't load Tkinter in embedded Python interpreter on Windows

2016-04-05 Thread Kevin Walzer
Adding PySys_SetArgv(argc, argv); did the trick. -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com -- https://mail.python.org/mailman/listinfo/python-list

Can't load Tkinter in embedded Python interpreter on Windows

2016-04-05 Thread Kevin Walzer
I am trying to build a stub exe on Windows that embeds Python and launches my Tkinter app. I want a full-blown exe program starter because the various Python freezing tools (py2exe, pyinstaller) do not work to my satisfaction with Python 3.5. I am able to get the executable built but I cannot

Windows - Embedded Python in C++: ImportError: DLL load failed. Python expert advice needed.

2016-01-27 Thread ftpronk
I've been busy porting a Linux code to Windows, and originally decided to go for the mingw-w64 toolchain set, with gcc-4.8 and win32 threading model. I'm embedding Python in C++ code, and I need to be able to import specific modules, like PySide, to eventually embed an IPython qtconsole in a C++

Re: Strange crash while running a script with a embedded python interpreter

2016-01-11 Thread Chris Angelico
On Mon, Jan 11, 2016 at 6:55 PM, Rickard Englund wrote: > On Friday, January 8, 2016 at 11:28:53 PM UTC+1, Michael Torrie wrote: >> On 01/08/2016 09:18 AM, Rickard Englund wrote: >> > First, some system info >> > * Windows 7 (also tested on 8 and 10) >> > * Python 3.5.1 64bit (previously also test

Re: Strange crash while running a script with a embedded python interpreter

2016-01-11 Thread Rickard Englund
On Friday, January 8, 2016 at 11:28:53 PM UTC+1, Michael Torrie wrote: > On 01/08/2016 09:18 AM, Rickard Englund wrote: > > First, some system info > > * Windows 7 (also tested on 8 and 10) > > * Python 3.5.1 64bit (previously also tested using several 3.x versions) > > (also tested with 32 bit,

Re: Strange crash while running a script with a embedded python interpreter

2016-01-08 Thread Michael Torrie
On 01/08/2016 09:18 AM, Rickard Englund wrote: > First, some system info > * Windows 7 (also tested on 8 and 10) > * Python 3.5.1 64bit (previously also tested using several 3.x versions) > (also tested with 32 bit, but with 3.4.2) > * Microsoft Visual Studio 2015 (earlier version of python als

Re: Strange crash while running a script with a embedded python interpreter

2016-01-08 Thread Rickard Englund
and on MacOS where it > works as expected, the problem is only in Windows. > > > Problem description: > We have an application for scientific visualization in which we have enabled > scripting using embedded python. We have exposed quite some features of our > application to p

Strange crash while running a script with a embedded python interpreter

2016-01-08 Thread Rickard Englund
scientific visualization in which we have enabled scripting using embedded python. We have exposed quite some features of our application to python using modules, this works perfectly fine. The problem we have is that the application crashes as soon as a script is trying to import some of python&#

Re: Embedded Python and C Callback functions

2015-06-07 Thread dieter
doc.mefi...@gmail.com writes: > I'm trying to debug and find my error. It goes wrong when: > PyObject *v; > v = va_arg(*p_va, PyObject *); > if (v != NULL) { > if (*(*p_format - 1) != 'N') > Py_INCREF(v); > } > > it tries to

Re: Embedded Python and C Callback functions

2015-06-07 Thread Stefan Behnel
doc.mefi...@gmail.com schrieb am 07.06.2015 um 10:56: > And I can't use Cython, because I have C++ module, and I have to use it. That's not a valid reason. Cython supports C++ code just fine. http://docs.cython.org/src/userguide/wrapping_CPlusPlus.html Stefan -- https://mail.python.org/mailma

Re: Embedded Python and C Callback functions

2015-06-07 Thread doc . mefisto
> >And I can't use Cython, because I have C++ module, and I have to use it. > >-- > >https://mail.python.org/mailman/listinfo/python-list > > Are you using Boost? > http://www.boost.org/doc/libs/1_58_0/libs/python/doc/ > > It handles lots of the setup for you. > > Laura No, I'm not using Boost

Re: Embedded Python and C Callback functions

2015-06-07 Thread Laura Creighton
In a message of Sun, 07 Jun 2015 01:56:47 -0700, doc.mefi...@gmail.com writes: >And I can't use Cython, because I have C++ module, and I have to use it. >-- >https://mail.python.org/mailman/listinfo/python-list Are you using Boost? http://www.boost.org/doc/libs/1_58_0/libs/python/doc/ It handles

Re: Embedded Python and C Callback functions

2015-06-07 Thread doc . mefisto
I'm trying to debug and find my error. It goes wrong when: PyObject *v; v = va_arg(*p_va, PyObject *); if (v != NULL) { if (*(*p_format - 1) != 'N') Py_INCREF(v); } it tries to PyINCREF to my passed callback. -- https://mail

Re: Embedded Python and C Callback functions

2015-06-07 Thread doc . mefisto
And I can't use Cython, because I have C++ module, and I have to use it. -- https://mail.python.org/mailman/listinfo/python-list

Re: Embedded Python and C Callback functions

2015-06-07 Thread doc . mefisto
No, myclass is not null. I think my style of passing arguments is wrong. -- https://mail.python.org/mailman/listinfo/python-list

Re: Embedded Python and C Callback functions

2015-06-06 Thread dieter
doc.mefi...@gmail.com writes: > Hi. I'm a newbie in python. But I want embed it in my C program. > > There is such method of my class: > @staticmethod > def install_instr_callback(callback): > # set hook for every change of PC > m68k.set_instr_hook_callback(callback) > > And in my C code t

Embedded Python and C Callback functions

2015-06-06 Thread doc . mefisto
Hi. I'm a newbie in python. But I want embed it in my C program. There is such method of my class: @staticmethod def install_instr_callback(callback): # set hook for every change of PC m68k.set_instr_hook_callback(callback) And in my C code there is such callback function: static PyObject

Embedded Python. Debug Version and _ctypes

2015-05-27 Thread Uladzimir Kryvian
Hi! I'm trying to use embedding of Python in my program. Simple C-program, compiled in Debug, that uses py-script that just imports "ctypes" gives me an error about "no module named "_ctypes". How to compile python lib in Visual Studio statically with ctypes support? Or how to use shared ctypes l

Re: exporting c_variable to embedded python module

2015-01-08 Thread kenakahn
I want to access c-side global variables from the python side. -- https://mail.python.org/mailman/listinfo/python-list

Re: exporting c_variable to embedded python module

2015-01-08 Thread Chris Angelico
On Fri, Jan 9, 2015 at 8:03 AM, wrote: > I'm running a python script loaded via PyImport_Import in my C++ program on > Linux. Is there any way I can pass a value from the c-code to the loaded > python module? To answer this question, first think about how you would like to see that value on t

exporting c_variable to embedded python module

2015-01-08 Thread kenakahn
I'm running a python script loaded via PyImport_Import in my C++ program on Linux. Is there any way I can pass a value from the c-code to the loaded python module? -- https://mail.python.org/mailman/listinfo/python-list

Re: Embedded python 'scripting engine' inside Python app

2014-11-24 Thread Chris Angelico
On Tue, Nov 25, 2014 at 6:38 PM, Patrick Stinson wrote: > Thanks for the stories in this and the other thread. I love these interesting > problems that push the limits :) I agree. How boring is life when we never push the limits! ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: Embedded python 'scripting engine' inside Python app

2014-11-24 Thread Patrick Stinson
> On Nov 23, 2014, at 4:57 AM, Chris Angelico wrote: > > On Mon, Nov 24, 2014 at 12:20 AM, Patrick Stinson > wrote: >> I think this is the way I’ll take it, and for all the same reasons. The only >> way they can break it is if they really want to. I guess anything other >> Franken-apps would

Re: Embedded python 'scripting engine' inside Python app

2014-11-24 Thread Patrick Stinson
I think this is the way I’ll take it, and for all the same reasons. The only way they can break it is if they really want to. I guess anything other Franken-apps would be interesting to hear about too. And I’ll still stick it on the app store. > On Nov 23, 2014, at 1:35 AM, Chris Angelico wro

Re: Embedded python 'scripting engine' inside Python app

2014-11-24 Thread Patrick Stinson
Thanks for your great reply. I even augmented the reloading with the same dict by clearing all of the non-standard symbols from the dict. This effectively resets the dict: # try to clear out the module by deleting all global refs

Re: Embedded python 'scripting engine' inside Python app

2014-11-23 Thread Chris Angelico
On Mon, Nov 24, 2014 at 12:20 AM, Patrick Stinson wrote: > I think this is the way I’ll take it, and for all the same reasons. The only > way they can break it is if they really want to. I guess anything other > Franken-apps would be interesting to hear about too. And I’ll still stick it > on t

Re: Embedded python 'scripting engine' inside Python app

2014-11-23 Thread Stefan Behnel
Chris Angelico schrieb am 23.11.2014 um 11:35: > On Sun, Nov 23, 2014 at 9:28 PM, Patrick Stinson wrote: >> Is there a better and more secure way to do the python-within-python in >> order allow users to automate your app? > > More secure? Basically no. You could push the inner script into a > sep

Re: Embedded python 'scripting engine' inside Python app

2014-11-23 Thread Chris Angelico
On Sun, Nov 23, 2014 at 9:28 PM, Patrick Stinson wrote: > Thanks for your great reply. I even augmented the reloading with the same > dict by clearing all of the non-standard symbols from the dict. This > effectively resets the dict: You may as well start with an empty dict and then pick up the f

Re: Embedded python 'scripting engine' inside Python app

2014-11-23 Thread Chris Angelico
On Sun, Nov 23, 2014 at 4:48 PM, Patrick Stinson wrote: > I am writing a python app (using PyQt, but that’s not important here), and > want my users to be able to write their own scripts to automate the app’s > functioning using an engine API hat I expose. I have extensive experience > doing th

Embedded python 'scripting engine' inside Python app

2014-11-23 Thread Patrick Stinson
I am writing a python app (using PyQt, but that’s not important here), and want my users to be able to write their own scripts to automate the app’s functioning using an engine API hat I expose. I have extensive experience doing this in a C++ app with the CPython api, but have no idea how to do

Re: can't get utf8 / unicode strings from embedded python

2013-08-28 Thread David M. Cotter
Thank you for your thoughtful and thorough response. I now understand much better what you (and apparently the others) were warning me against and I will certainly consider that moving forward. I very much appreciate your help as I learn about python and embedding and all these crazy encoding

Re: can't get utf8 / unicode strings from embedded python

2013-08-28 Thread Steven D'Aprano
On Tue, 27 Aug 2013 22:57:45 -0700, David M. Cotter wrote: > I am very sorry that I have offended you to such a degree you feel it > necessary to publicly eviscerate me. You know David, you are right. I did over-react. And I apologise for that. I am sorry, I was excessively confrontational. (Alt

Re: can't get utf8 / unicode strings from embedded python

2013-08-27 Thread David M. Cotter
I am very sorry that I have offended you to such a degree you feel it necessary to publicly eviscerate me. Perhaps I could have worded it like this: "So far I have not seen any troubles including unicode characters in my strings, they *seem* to be fine for my use-case. What kind of trouble ha

Re: can't get utf8 / unicode strings from embedded python

2013-08-27 Thread Steven D'Aprano
On Tue, 27 Aug 2013 15:21:00 -0700, David M. Cotter wrote: > i am already doing (3), and all is working perfectly. bytestring > literals are fine, i'm not sure what this trouble is that you speak of. Neither is anyone else, because your post is completely devoid of any context. Who are you talk

Re: can't get utf8 / unicode strings from embedded python

2013-08-27 Thread David M. Cotter
i am already doing (3), and all is working perfectly. bytestring literals are fine, i'm not sure what this trouble is that you speak of. note that i'm not using PyRun_AnyFile(), i'm loading the script myself, assumed as utf8 (which was my original problem, i had assumed it was macRoman), then

Re: can't get utf8 / unicode strings from embedded python

2013-08-25 Thread MRAB
On 25/08/2013 23:32, David M. Cotter wrote: i got it!! OMG! so sorry for the confusion, but i learned a lot, and i can share the result: the CORRECT code *was* what i had assumed. the Python side has always been correct (no need to put "u" in front of strings, it is known that the bytes are u

Re: can't get utf8 / unicode strings from embedded python

2013-08-25 Thread David M. Cotter
i got it!! OMG! so sorry for the confusion, but i learned a lot, and i can share the result: the CORRECT code *was* what i had assumed. the Python side has always been correct (no need to put "u" in front of strings, it is known that the bytes are utf8 bytes) it was my "run script" function

Re: can't get utf8 / unicode strings from embedded python

2013-08-25 Thread David M. Cotter
fair enough. I can provide further proof of strangeness. here is my latest script: this is saved on disk as a UTF8 encoded file, and when viewing as UTF8, it shows the correct characters. == # -*- coding: utf-8 -*- import time, kjams, kjams_lib def log_success(msg, successB, s

Re: can't get utf8 / unicode strings from embedded python

2013-08-25 Thread Terry Reedy
On 8/25/2013 1:57 PM, David M. Cotter wrote: i'm sorry this is so confusing, let me try to re-state the problem in as clear a way as i can. I have a C++ program, with very well tested unicode support. All logging is done in utf8. I have conversion routines that work flawlessly, so i can assu

Re: can't get utf8 / unicode strings from embedded python

2013-08-25 Thread Vlastimil Brom
2013/8/25 David M. Cotter : > i'm sorry this is so confusing, let me try to re-state the problem in as > clear a way as i can. > > I have a C++ program, with very well tested unicode support. All logging is > done in utf8. I have conversion routines that work flawlessly, so i can > assure you

Re: can't get utf8 / unicode strings from embedded python

2013-08-25 Thread David M. Cotter
i'm sorry this is so confusing, let me try to re-state the problem in as clear a way as i can. I have a C++ program, with very well tested unicode support. All logging is done in utf8. I have conversion routines that work flawlessly, so i can assure you there is nothing wrong with logging and

Re: can't get utf8 / unicode strings from embedded python

2013-08-24 Thread random832
On Sat, Aug 24, 2013, at 12:47, David M. Cotter wrote: > > What _are_ you using? > i have scripts in a file, that i am invoking into my embedded python > within a C++ program. there is no terminal involved. the "print" > statement has been redirected (via sys.stdout)

Re: can't get utf8 / unicode strings from embedded python

2013-08-24 Thread Benjamin Kaplan
On Sat, Aug 24, 2013 at 9:47 AM, David M. Cotter wrote: > > > What _are_ you using? > i have scripts in a file, that i am invoking into my embedded python within a > C++ program. there is no terminal involved. the "print" statement has been > redirected (via sy

Re: can't get utf8 / unicode strings from embedded python

2013-08-24 Thread wxjmfauth
Le samedi 24 août 2013 18:47:19 UTC+2, David M. Cotter a écrit : > > What _are_ you using? > > i have scripts in a file, that i am invoking into my embedded python within a > C++ program. there is no terminal involved. the "print" statement has been > redirected (

Re: can't get utf8 / unicode strings from embedded python

2013-08-24 Thread David M. Cotter
> What _are_ you using? i have scripts in a file, that i am invoking into my embedded python within a C++ program. there is no terminal involved. the "print" statement has been redirected (via sys.stdout) to my custom print class, which does not specify "encoding", so

Re: can't get utf8 / unicode strings from embedded python

2013-08-24 Thread random832
On Sat, Aug 24, 2013, at 2:45, David M. Cotter wrote: > > you need to use u" ... " delimiters for Unicode, otherwise the results you > > get are completely arbitrary and depend on the encoding of your terminal. > okay, well, i'm on a mac, and not using "terminal" at all. but if i > were, it woul

Re: can't get utf8 / unicode strings from embedded python

2013-08-24 Thread Dave Angel
David M. Cotter wrote: > Steven wrote: >> I see you are using Python 2 > correct > >>It's hard to say what *exactly* is happening here, because you don't explain >>how the python print statement somehow gets into your C++ Log code. Do I >>guess right that it catches stdout? > yes, i'm redirecting

Re: can't get utf8 / unicode strings from embedded python

2013-08-23 Thread David M. Cotter
t flying :( > For example, if I set my terminal encoding to IBM-850 okay how do you even do that? this is not an interactive session, this is embedded python, within a C++ app, so there's no terminal. but that is a good question: all the docs say "default encoding" everywhere

Re: can't get utf8 / unicode strings from embedded python

2013-08-23 Thread Steven D'Aprano
On Fri, 23 Aug 2013 13:49:23 -0700, David M. Cotter wrote: > note everything works great if i use Ascii, but: > > in my utf8-encoded script i have this: > >> print "frøânçïé" I see you are using Python 2, in which case there are probably two or three errors being made here. Firstly, in

can't get utf8 / unicode strings from embedded python

2013-08-23 Thread David M. Cotter
note everything works great if i use Ascii, but: in my utf8-encoded script i have this: > print "frøânçïé" in my embedded C++ i have this: PyObject* CPython_Script::print(PyObject *args) { PyObject*resultObjP = NULL; const char *utf8_

Re: how to package embedded python?

2013-08-01 Thread CM
On Wednesday, July 31, 2013 11:47:19 AM UTC-4, David M. Cotter wrote: > okay, well that might turn out to be useful, except i don't quite know how to > use it, and there are no "from scratch" instructions. > > > > i managed to download "py2exe-0.6.9.zip" and unzip it, but how does one > "insta

Re: how to package embedded python?

2013-07-31 Thread David M. Cotter
okay, well that might turn out to be useful, except i don't quite know how to use it, and there are no "from scratch" instructions. i managed to download "py2exe-0.6.9.zip" and unzip it, but how does one "install" this package? (yes, still a newb at that) then, once installed, how do i say "in

Re: how to package embedded python?

2013-07-30 Thread CM
kaging up a Python interpreter with an application that needs it, could you use py2exe to do that? If, so is this helpful (gotten from Google's cache since page doesn't appear at the moment...later try embedded Python py2exe search)?: http://webcache.googleusercontent.com/

Re: how to package embedded python?

2013-07-30 Thread David M. Cotter
yes, i've looked there, and all over google. i'm quite expert at embedding at this point. however nowhere i have looked has had instructions for "this this is how you package up your .exe with all the necessary python modules necessary to actually run on a user's system that does not have pyth

Re: how to package embedded python?

2013-07-29 Thread Kevin Walzer
On 7/25/13 5:05 PM, David M. Cotter wrote: what must i include in my app package if i'm embedding python? i tried including *everything* in the "DLLs" directory, but my app still crashes as soon as i attempt to initialize python. this is on a system that does not have python installed, as most

Re: how to package embedded python?

2013-07-29 Thread David M. Cotter
nooobody knw the trouble a s... -- http://mail.python.org/mailman/listinfo/python-list

Re: embedded python and threading

2013-07-26 Thread Stefan Behnel
David M. Cotter, 26.07.2013 19:28: > DOH! as my second thread, i had been using a sample script that i had > copy-pasted without much looking at it. guess what? it prints the time. and > yes, it did "from time import time", which explains it all. Ah, and you were using the same globals dict f

Re: embedded python and threading

2013-07-26 Thread David M. Cotter
DOH! as my second thread, i had been using a sample script that i had copy-pasted without much looking at it. guess what? it prints the time. and yes, it did "from time import time", which explains it all. thanks for the hints here, that helped me figure it out! -- http://mail.python.org/mai

Re: embedded python and threading

2013-07-26 Thread David M. Cotter
no, there is no "time.py" anywhere (except perhaps as the actual python library originally imported) did you understand that the function works perfectly, looping as it should, up until the time i run a second script on a separate thread? -- http://mail.python.org/mailman/listinfo/python-list

Re: embedded python and threading

2013-07-26 Thread John Gordon
In <965b463e-e5bf-4ccd-9a3c-b0cb964b3...@googlegroups.com> "David M. Cotter" writes: > == > 9: Traceback (most recent call last): > 9: File "", line 10, in ? > 9: File "", line 6, in main > 9: AttributeError: 'builtin_function_or_method

  1   2   3   4   >