0

So I downloaded source for Python3.4 and used VisualStudio 2010 to build a Python executable for my Windows7 machine. Ultimately, I want to use this to embed Python support in my application.

The first time I tried to execute my app, PyInitialise ends up aborting, and presents the error message:

"Py_Initialize: unable to load the file system codec"

So now I'm thinking, D'oh, you never installed your Python build after building it. After much googling, I find myself running msi.py. When I do, I see:

File "msi.py", line 934

raise ValueError, "Could not find "+srcdir+"/../"+pat
                ^

SyntaxError: invalid syntax

This looks to me like I'm trying to run pre-Python3.X code. But I'm so sure this MSI tool came with my Python3.4 source distribution. That said, I've been staring at this for so long things are starting to blend to a blur.

Any clues about where to look or what to try next? Should I be worrying about MSI? Is there some other answer to my codec problem?

  • To start off with, don't use the development branch, but a stable branch (3.3). When you say "embed", do you mean fork to `python.exe` and capture the results, or you want to run Python code in your application _directly_? – Burhan Khalid Mar 24 '14 at 04:34
  • According to [Py_Initialize fails - unable to load the file system codec](http://stackoverflow.com/q/5694706), the “file system codec” error is due to Python not being able to find its `Lib` directory. There are a number of solutions there that do not involve installing Python. – icktoofay Mar 24 '14 at 04:35
  • Burhan: thx. No, I do not mean fork&exec, but link in either a static lib or ship my app with the DLLs. – user3453991 Mar 24 '14 at 20:48
  • icktoofay: thx. And, after I remove my forehead from the palm of my hand, I think I'll know what to do ;-) – user3453991 Mar 24 '14 at 20:49
  • Burhan: Your comment made me think I had made some mistake, but I checked, and it looks like Python3.4 was released *very* recently (16 March, 2014). I downloaded my copy on the 20th. Still leaves me wondering why msi.py looks like it's at least partly writting in Python 2.X syntax: print is sometimes a funtion, i.e. print("hello"), and somtimes not, i.e. print "hello". – user3453991 Mar 24 '14 at 23:22

0 Answers0