0

I'm trying to create an IRC client using the irclib library. When I try to freeze the script using cxFreeze, however, I always run into that error:

Traceback (most recent call last):
  File "C:\python27\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27, in <module>
    exec(code, m.__dict__)
  File "client.py", line 38, in <module>
ImportError: No module named jaraco

The setup.py script has been modified several times, to try to include files, packages and so on. Nothing seems to work. Here's the current version for reference:

from cx_Freeze import setup, Executable

client = Executable(
    script="client.py",
    base="Win32GUI",
)

setup(
    name = "client",
    version = "0.2",
    description = "client",
    options = {'build_exe': {'includes': ["jaraco"], "packages": ["jaraco"]}},
    executables = [client],
)

The script of the client can be shortened in a single line:

from irc import client

That's all. I'm not using Jaraco, irclib (package irc) is. Jaraco must have been installed as a dependency from irclib.

I've tried to find the reasons why it could happen, but so far, nothing found.

Thanks for your help!

vincent-lg
  • 539
  • 7
  • 15
  • Can you provide the script client.py? And the version of this jaraco that you are using? – Anthony Tuininga Oct 22 '16 at 15:29
  • @Tuininga: I'm only importing irc (I edited the post). I don't use Jaraco, but irclib does. I guess it was treated as a dependency when I installed irclib. – vincent-lg Oct 22 '16 at 16:14

1 Answers1

0

Well, after some digging around, it seems the same problem exists with zope when freezing an application with twisted. Although I haven't tested it with jaraco, I would imagine it's the same issue. I hope this solution works for users stuck with the same problem:

  1. In your 'site-packages' directory, in the 'jaraco' package, add the 'init.py' file. It can be empty. Why isn't it provided, I have no idea. A package without a 'init.py", for cxFreeze, isn't a package.
  2. Re-run the 'setup.py' script. Don't include 'jaraco' as a package, provide the package that needs it (here, it would be 'irc').

Here's the setup.py script:

from cx_Freeze import setup, Executable

client = Executable(
    script="client.py",
    base="Win32GUI",
)

setup(
    name = "client",
    version = "0.2",
    description = "client",
    options = {'build_exe': {'packages': ["irc"]}},
    executables = [client],
)

I provide this answer because it worked just fine with twisted and zope. Seeing my client uses twisted now for its IRC communication, I don't know if the provided steps below work, but that's what helped me for twisted.

HTH,

vincent-lg
  • 539
  • 7
  • 15