Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Embedding python : can't find encoding error

Reply
Thread Tools

Embedding python : can't find encoding error

 
 
Mathieu CLERICI
Guest
Posts: n/a
 
      02-28-2011
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.
 
Reply With Quote
 
 
 
 
Mathieu CLERICI
Guest
Posts: n/a
 
      02-28-2011
Precisions : I'm trying to embed python 3.2 release.
 
Reply With Quote
 
 
 
 
swapnil
Guest
Posts: n/a
 
      03-01-2011
On Feb 28, 4:57*pm, Mathieu CLERICI <mathieu.cler...@gmail.com> 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...ment-variables ) in
your program before calling Py_Initialize()
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading Text File Encoding and converting to Perls internal UTF-8 encoding sln@netherlands.com Perl Misc 2 04-17-2009 11:22 PM
Find.find does not find orphaned links? Wybo Dekker Ruby 1 11-15-2005 02:50 PM
cx_freeze error : LookupError: no codec search functions registered: can't find encoding Thomas W Python 1 06-09-2005 10:02 PM
changing JVM encoding; setting -Dfile.encoding doesn't work pasmol@plusnet.pl Java 1 10-08-2004 09:50 PM
Encoding.Default and Encoding.UTF8 Hardy Wang ASP .Net 5 06-09-2004 04:04 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57