Embedding python : can't find encoding error

Discussion in 'Python' started by Mathieu CLERICI, Feb 28, 2011.

  1. Hi,

    I'm trying to embed python in a c++ program.
    I have compiled python32.lib with msvc 2010 targetting 32bits, i link
    it with my program wich is also 32bit.
    I get an error when calling Py_Initialize() : "no codec search
    functions registered: can't find encoding"

    Py_FileSystemDefaultEncoding value is "mbcs".

    _PyCodec_Lookup raise an eror because len = PyList_Size(interp-
    >codec_search_path); returns 0 in codecs.c


    Does someone already had this problem ? I have no idea how to solve
    that.

    Sorry for my bad english.
     
    Mathieu CLERICI, Feb 28, 2011
    #1
    1. Advertising

  2. Precisions : I'm trying to embed python 3.2 release.
     
    Mathieu CLERICI, Feb 28, 2011
    #2
    1. Advertising

  3. Mathieu CLERICI

    swapnil Guest

    On Feb 28, 4:57 pm, Mathieu CLERICI <> wrote:
    > Hi,
    >
    > I'm trying to embed python in a c++ program.
    > I have compiled python32.lib with msvc 2010 targetting 32bits, i link
    > it with my program wich is also 32bit.
    > I get an error when calling Py_Initialize() : "no codec search
    > functions registered:  can't find encoding"
    >
    > Py_FileSystemDefaultEncoding value is "mbcs".
    >
    > _PyCodec_Lookup raise an eror because  len = PyList_Size(interp-
    >
    > >codec_search_path); returns 0 in codecs.c

    >
    > Does someone already had this problem ? I have no idea how to solve
    > that.
    >
    > Sorry for my bad english.


    While initializing python import site.py module and I think
    subsequently several other modules. Probably its in this process that
    Python is trying to register the codes from the encoding package of
    standard library. You must provide the path to the standard library to
    the exe that you generate. You can do this by setting the environment
    variables PYTHONPATH, PYTHONHOME (Refer
    http://docs.python.org/using/cmdline.html#environment-variables ) in
    your program before calling Py_Initialize()
     
    swapnil, Mar 1, 2011
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ad
    Replies:
    2
    Views:
    890
  2. Thomas W
    Replies:
    1
    Views:
    1,688
    Thomas W
    Jun 9, 2005
  3. Replies:
    1
    Views:
    280
    Gabriel Genellina
    Jul 6, 2007
  4. Wybo Dekker
    Replies:
    1
    Views:
    396
    Yukihiro Matsumoto
    Nov 15, 2005
  5. vdvorkin
    Replies:
    0
    Views:
    437
    vdvorkin
    Feb 10, 2011
Loading...

Share This Page