Re: [Python-Dev] Using environment variables problematic for embedded python.

2012-10-04 Thread Campbell Barton
post the > issue link here.) I do think you have a legitimate use case to set the > default encoding to utf-8. (Though there may be a way already.) Does Python > 3.3 have te same bug? > > > On Wednesday, October 3, 2012, Campbell Barton wrote: >> >> On Thu, Oct 4, 2012

Re: [Python-Dev] Using environment variables problematic for embedded python.

2012-10-03 Thread Campbell Barton
On Thu, Oct 4, 2012 at 1:35 PM, Campbell Barton wrote: > Hi, > > We've run into an issue recently with blender3d on ms-windows where we > want to enforce the encoding is UTF-8 with the embedded python > interpreter. > (the encoding defaults to cp437). > > I naively th

[Python-Dev] Using environment variables problematic for embedded python.

2012-10-03 Thread Campbell Barton
Hi, We've run into an issue recently with blender3d on ms-windows where we want to enforce the encoding is UTF-8 with the embedded python interpreter. (the encoding defaults to cp437). I naively thought setting the environment variable before calling Py_Initialize() would work, but the way python

[Python-Dev] Best practice for new namespace (from C/API)

2010-07-28 Thread Campbell Barton
Hi, I'm writing because I'm working on a project where the user can run scripts that don't reference a file but use internal application text data. Otherwise we are not doing anything tricky, only that the scripts should each run independently (no cruft left from the previous scripts namespace, sha

[Python-Dev] Py_CmpToRich removed, alternatives for comparison?

2009-09-02 Thread Campbell Barton
For blender we have a number of types defined in the C/API like meshes, lamps, metaballs, nurbs etc that dont make sense with some of richcmp's operations. A problem I have is that in python 3.1 the Py_CmpToRich function is removed. Should we copy Py_CmpToRich into our source tree? Otherwise we ha

Re: [Python-Dev] Py_TPFLAGS_HEAPTYPE too overloaded

2009-07-29 Thread Campbell Barton
On Sun, Jul 26, 2009 at 11:01 AM, Joshua Haberman wrote: > I'm writing a C Python extension that needs to generate PyTypeObjects > dynamically.  Unfortunately, the Py_TPFLAGS_HEAPTYPE flag is overloaded > in a way that makes it difficult to achieve this goal. > > The documentation for Pt_TPFLAGS_HE

Re: [Python-Dev] Suggested PySys_SetArgv use with a (char **) argv ?

2009-07-07 Thread Campbell Barton
The reason I was a big vague is that I'm not really bothered HOW its done, I'd just like there to be some way to use PySys_SetArgv with a (char **) Definitely not suggesting that PySys_SetArgv be reverted to the way it worked in py2.x, if there was 2 versions of PySys_SetArgv that would be accepta

[Python-Dev] Suggested PySys_SetArgv use with a (char **) argv ?

2009-07-07 Thread Campbell Barton
In Python3 PySys_SetArgv takes (wchar_t **) for the argv, I looked into converting a (char **) into a (wchar_t **) and while its possible its lengthy enough not to be trivial, see python.c:18 - char2wcharm(), its 102 lines with ifdef's and goto's, not including the loop lower down that loops over t

[Python-Dev] Warnings when no file exists.

2009-05-28 Thread Campbell Barton
Hi, there has been a problem in blender3d for 6~ years or so thats eluded me, I decided to look into today. - Whenever the a script raises a warnings python prints out binary garbage in the console. Some users complain when they run python games in blender they get beeps coming from the PC speaker.

[Python-Dev] C/Python API Index removed?

2009-05-28 Thread Campbell Barton
This page used to give an index of the C/Python API functions too http://docs.python.org/genindex-all.html But a week or so ago I noticed all these functions are now missing (I remember they existed in 2.6.1 docs) Was this intentional? Quite a while ago, ~2.5 the C/API docs had their own index wh

[Python-Dev] PyCFunction_* Missing

2009-04-08 Thread Campbell Barton
Hi, Just noticed the new Python 2.6.2 docs now dont have any reference to * PyCFunction_New * PyCFunction_NewEx * PyCFunction_Check * PyCFunction_Call Ofcourse these are still in the source code but Im wondering if this is intentional that these functions should be for internal use only? -- - Cam

[Python-Dev] python 3.0, tp_compare not used for == test?

2009-02-01 Thread Campbell Barton
Hi, I have been writing a new C api that can build with both python 2.6 and 3.0 I found that when building with python 2.6, doing "a==b" between 2 different pyrna_struct_Type's would run tp_compare But with python 3.0, "a==b" will always be false and tp_compare function would not even run. The on

[Python-Dev] Py/C API sig is here! --- (Was "Calling Methods from Pythons C API with Keywords")

2007-06-29 Thread Campbell Barton
Hrvoje Nikšić wrote: > On Thu, 2007-06-21 at 19:25 +0200, "Martin v. Löwis" wrote: >> In the past, we created special-interest groups for such discussion. >> Would you like to coordinate a C sig? See >> >> http://www.python.org/community/sigs/ > > A SIG sounds like an excellent idea. If crea

Re: [Python-Dev] Calling Methods from Pythons C API with Keywords

2007-06-21 Thread Campbell Barton
The reason I asked on this in the first place is I had looked through the python source to make sure PyObject_Call had no equivalent that supported keywords, and since I needed to do this I figured it might be worth considering for Pythons API. Im sure everyone could write their own PyObject_Ca

Re: [Python-Dev] Calling Methods from Pythons C API with Keywords

2007-06-20 Thread Campbell Barton
Hrvoje Nikšić wrote: > [ Note that this discussion, except maybe for the suggestion to add a > simpler way to call a method with keyword args, is off-topic to > python-dev. ] Is there a list for this kind of discussion? Iv tried asking questions on the freenode python chat room but almost very

Re: [Python-Dev] Calling Methods from Pythons C API with Keywords

2007-06-20 Thread Campbell Barton
Hrvoje Nikšić wrote: > On Wed, 2007-06-20 at 00:21 +1000, Campbell Barton wrote: >> I want to add my own call's before and after PyLists standard functions >> but have a proplem with functons that use keywords and have no API >> equivalent. >> For example, I cant u

[Python-Dev] Calling Methods from Pythons C API with Keywords

2007-06-19 Thread Campbell Barton
Hey Guys, My first post on this list so I hope this is the right place to post and relevant. Im rewriting parts of the Blender3D python API that has got a bit old and needs an update. Im making a PyList subtype with the C/Python API, this involves intercepting calls to standard list methods to ma