Fixes for ConsoleSetLibPath and small fix for Python 3

#42 Merged at 7d9a313
Repository
cx_Freeze-fixes
Branch
default
Repository
cx_Freeze
Branch
default
Author
  1. Dan McCombs
Reviewers
Description

When trying to use ConsoleSetLibPath the importer was having trouble finding the code to exec after setting the environment variable. As @Thomas Kluyver pointed out, the default Console init script takes a slightly different approach, and was working in my situation.

This change determines the module name to exec the same way as was done in Console.py, fixing a bug where the frozen executable fails to launch in some cases when using the ConsoleSetLibPath init script. Also, this changes the exec statement to be compatible with Python 3. This tuple form also works as low as Python 2.3. (tested)

Comments (5)

  1. Thomas Kluyver

    Actually, I think that using the tuple form, we could do away with the need for separate foo and foo3 initscripts, which would simplify the code. You don't need to do that in this PR, though.

    1. Dan McCombs author

      Yep, those scripts were actually the reason I went all the way back and tested on Python 2.3 - I saw it was only documented in 2.7, so I was wondering it didn't actually work prior to that, but turns out it was just undocumented.

      I wasn't sure if the *3 variants get specified by users, or used automatically as needed, if it's the later then they can definitely be removed in favor of that exec tuple change in the other scripts.

  2. Anthony Tuininga repo owner

    I just made an additional change inspired by this one to remove the Console3 and ConsoleKeepPath3 initscripts since the only difference between them was the exec statement -- a nice simplification. Thanks!