Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: 'list' object has no attribute 'rfind' in using cx_freeze

I have a project in this structure on my linux machine:

project/
       changelog
       README
       src/
          install.sh
          myproject.py
          modules/
                 a.py 
                 b.py
                 __init__.py

Now I want to use cx_freeze for building my project:

import sys
from cx_Freeze import setup,Executable

includefiles = ['changelog', 'README', 'src/install.sh']
executable = ['src/myproject.py', 'src/modules/a.py',  'src/modules/b.py', 'src/modules/__init__.py']
includes = []
excludes = []
packages = []

setup(
    name = 'myproject',
    version = '0.1',
    description = 'A general enhancement utility',
    author = 'user',
    author_email = '[email protected]',
    options = {'build_exe': {'excludes':excludes,'packages':packages,'include_files':includefiles}},
    executables = [Executable(executable)]

I do:

$ python setup.py build

But the following error occurs:

AttributeError: 'list' object has no attribute 'rfind'
like image 978
MLSC Avatar asked Jan 28 '26 17:01

MLSC


1 Answers

You assign an array to executable variable

executable = ['src/myproject.py', 'src/modules/a.py',  'src/modules/b.py', 'src/modules/__init__.py']

but it should be a string. Please refer to manual. An example from the manual:

setup(  name = "guifoo",
        version = "0.1",
        description = "My GUI application!",
        options = {"build_exe": build_exe_options},
        executables = [Executable("guifoo.py", base=base)])
like image 71
Martin Vseticka Avatar answered Jan 31 '26 06:01

Martin Vseticka



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!