• Problem using cx_Freeze

    From David at Booomer@21:1/5 to All on Mon Aug 15 10:30:41 2022
    I’m trying to use cx_Freeze (https://pypi.org/project/cx-Freeze/) in a python app but running into an error message:

    AttributeError: module 'cx_Freeze' has no attribute ‘BdistDMG’

    I’m using Anaconda and error appears with the import command: from cx_Freeze import *

    From the terminal the command: python setup.py build gives much the same error.

    I believe there is an issue specifying the output file name but don’t know how to resolve it.

    Any suggestions, thanks. David

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From jschwar@sbcglobal.net@21:1/5 to All on Mon Aug 15 16:45:39 2022
    I see a class called BdistDMG in the module called bdist_mac.py. Did you try importing that from cx_freeze?

    -----Original Message-----
    From: Python-list <python-list-bounces+jschwar=sbcglobal.net@python.org> On Behalf Of David at Booomer
    Sent: Monday, August 15, 2022 11:31 AM
    To: python-list@python.org
    Subject: Problem using cx_Freeze

    I’m trying to use cx_Freeze (https://pypi.org/project/cx-Freeze/) in a python app but running into an error message:

    AttributeError: module 'cx_Freeze' has no attribute ‘BdistDMG’

    I’m using Anaconda and error appears with the import command: from cx_Freeze import *

    From the terminal the command: python setup.py build gives much the same error.

    I believe there is an issue specifying the output file name but don’t know how to resolve it.

    Any suggestions, thanks. David


    --
    https://mail.python.org/mailman/listinfo/python-list

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dennis Lee Bieber@21:1/5 to All on Mon Aug 15 18:45:05 2022
    On Mon, 15 Aug 2022 10:30:41 -0600, David at Booomer <david@boomer.org> declaimed the following:

    I’m trying to use cx_Freeze (https://pypi.org/project/cx-Freeze/) in a python app but running into an error message:

    AttributeError: module 'cx_Freeze' has no attribute ‘BdistDMG’

    What operating system? BdistDMG appears to be a Macintosh OS module -- something to do with disk images

    https://cx-freeze.readthedocs.io/en/latest/setup_script.html
    """
    On Windows, you can build a simple installer containing all the files
    cx_Freeze includes for your application, by running the setup script as:

    python setup.py bdist_msi

    On Mac OS X, you can use bdist_dmg to build a Mac disk image.
    """

    Note the command syntax and last line...


    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jim Schwartz@21:1/5 to All on Mon Aug 15 18:51:02 2022
    This link covers how to use BDist_dmg.

    https://cx-freeze.readthedocs.io/en/latest/setup_script.html

    Sent from my iPhone

    On Aug 15, 2022, at 12:11 PM, David at Booomer <david@boomer.org> wrote:

    I’m trying to use cx_Freeze (https://pypi.org/project/cx-Freeze/) in a python app but running into an error message:

    AttributeError: module 'cx_Freeze' has no attribute ‘BdistDMG’

    I’m using Anaconda and error appears with the import command: from cx_Freeze import *

    From the terminal the command: python setup.py build gives much the same error.

    I believe there is an issue specifying the output file name but don’t know how to resolve it.

    Any suggestions, thanks. David


    --
    https://mail.python.org/mailman/listinfo/python-list

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David at Booomer@21:1/5 to All on Mon Aug 15 18:00:48 2022
    Hi Jim

    Thanks for your suggestions.

    I changed

    from cx_Freeze import *

    to

    from cx_Freeze import setup, Executable

    And no longer get the BdistDMG error


    I had found the page https://cx-freeze.readthedocs.io/en/latest/setup_script.html
    But hadn’t tried the setup, Executable option in the from statement


    However I now get an error

    init() takes from 2 to 12 positional arguments but 14 were given

    I found a couple instances of init in two .py files that were part of the whole.

    One .py file
    def __init__(self):

    Another .py file
    class Aboutwindow(QtGui.QMainWindow, Ui_Aboutwindow):
    def __init__(self,parent=None):
    QtGui.QMainWindow.__init__(self,parent)

    class Main(QtGui.QMainWindow):

    def __init__(self):
    QtGui.QMainWindow.__init__(self)

    When searching for this error the answers found suggested including self in the init parameter list but the code already has self.

    Thanks, David

    On Aug 15, 2022, at 5:51 PM, Jim Schwartz <jschwar@sbcglobal.net> wrote:

    This link covers how to use BDist_dmg.

    https://cx-freeze.readthedocs.io/en/latest/setup_script.html

    Sent from my iPhone

    On Aug 15, 2022, at 12:11 PM, David at Booomer <david@boomer.org> wrote:

    I’m trying to use cx_Freeze (https://pypi.org/project/cx-Freeze/) in a python app but running into an error message:

    AttributeError: module 'cx_Freeze' has no attribute ‘BdistDMG’

    I’m using Anaconda and error appears with the import command: from cx_Freeze import *

    From the terminal the command: python setup.py build gives much the same error.

    I believe there is an issue specifying the output file name but don’t know how to resolve it.

    Any suggestions, thanks. David


    --
    https://mail.python.org/mailman/listinfo/python-list

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dennis Lee Bieber@21:1/5 to All on Mon Aug 15 22:18:54 2022
    On Mon, 15 Aug 2022 18:00:48 -0600, David at Booomer <david@boomer.org> declaimed the following:


    However I now get an error

    init() takes from 2 to 12 positional arguments but 14 were given

    I found a couple instances of init in two .py files that were part of the whole.

    One .py file
    def __init__(self):


    Please cut&paste the TEXT of the console where the errors are displayed -- don't paraphrase!

    init() is NOT the same as __init__()

    WHAT "One .py file"? This is a meaningless bit of information.

    The most likely __init__() involved is the one where cx_Freeze.Executable is instantiated. https://cx-freeze.readthedocs.io/en/latest/setup_script.html#cx-freeze-executable
    shows 11 parameters (and "self" would make the 12th).





    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David at Booomer@21:1/5 to All on Wed Aug 17 12:09:14 2022
    Hi Dennis

    Thank you for your reply. I’m am trying to get LaTex-to-Speech (https://github.com/SGanesh19/LaTeX-to-Speech) to run as an accessibility aid, converting equations into speech. I haven’t used cx_Freeze before so stumbling somewhat.

    The error returned is

    File "/Users/duser/Documents/Win_ShareFolder/LaTeX-to-Speech-master/setup.py", line 9, in <module>
    Executable(
    TypeError: __init__() takes from 2 to 12 positional arguments but 14 were given

    The setup.py file is currently

    import cx_Freeze
    # from cx_Freeze import *
    from cx_Freeze import setup, Executable

    setup(
    name="Latex2Speech",
    options = {'build_exe':{'packages':['gtts','pyglet','PyQt4']}},
    executables=[
    Executable(
    "prjui.py","Maiui.py","about.py","dict.py","geometry.py","getEquation.py",
    "gtrail.py","main.py","matchingstring.py","producelatex.py","readfile.py",
    "separete.py","speak.py",
    )
    ]
    )

    I am/was worried about the trailing ‘,' after ',"speak.py”,’ <- but deleting it or moving it after the ] didn’t help. Adding base = None also didn’t help.

    Searching for ‘__init__(' in the 13 *.py files returned five lines in two files (algorithm.py and prjui.py). As mentioned searching for this error only produced mention of adding self which is in these lines already. Previously I had search for __init__
    () which returned no lines due to the closing ).

    I had visited the page you provided (https://cx-freeze.readthedocs.io/en/latest/setup_script.html#cx-freeze-executable) but didn’t noticed the 11 plus self as 12 arguments.

    Thanks again for any suggestions.

    David


    From: Dennis Lee Bieber <wlfraed@ix.netcom.com>
    Subject: Re: Problem using cx_Freeze
    Date: August 15, 2022 at 8:18:54 PM MDT
    To: python-list@python.org


    On Mon, 15 Aug 2022 18:00:48 -0600, David at Booomer <david@boomer.org> declaimed the following:


    However I now get an error

    init() takes from 2 to 12 positional arguments but 14 were given

    I found a couple instances of init in two .py files that were part of the whole.

    One .py file
    def __init__(self):


    Please cut&paste the TEXT of the console where the errors are displayed -- don't paraphrase!

    init() is NOT the same as __init__()

    WHAT "One .py file"? This is a meaningless bit of information.

    The most likely __init__() involved is the one where cx_Freeze.Executable is instantiated. https://cx-freeze.readthedocs.io/en/latest/setup_script.html#cx-freeze-executable
    shows 11 parameters (and "self" would make the 12th).

    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dennis Lee Bieber@21:1/5 to All on Wed Aug 17 15:36:10 2022
    On Wed, 17 Aug 2022 12:09:14 -0600, David at Booomer <david@boomer.org> declaimed the following:

    executables=[
    Executable(
    "prjui.py","Maiui.py","about.py","dict.py","geometry.py","getEquation.py",
    "gtrail.py","main.py","matchingstring.py","producelatex.py","readfile.py",
    "separete.py","speak.py",
    )
    ]
    )

    You are defining a list "executables" with only ONE member... (and is that really how you spelled "separate").

    Searching for ‘__init__(' in the 13 *.py files returned five lines in two files (algorithm.py and prjui.py). As mentioned searching for this error only produced mention of adding self which is in these lines already. Previously I had search for __init_
    _() which returned no lines due to the closing ).

    You are still searching the wrong place... The __init__() that is complaining is the one in cx_Freeze.Executable().

    I had visited the page you provided (https://cx-freeze.readthedocs.io/en/latest/setup_script.html#cx-freeze-executable) but didn’t noticed the 11 plus self as 12 arguments.

    Really? Please count (reformatted from cut&paste):
    """
    argument name description

    #1
    script the name of the file containing the script
    which is to be frozen

    #2
    init_script the name of the initialization script that will
    be executed before the actual script is executed; this script is used to
    set up the environment for the executable; if a name is given without an absolute path the names of files in the initscripts subdirectory of the cx_Freeze package is searched

    #3
    base the name of the base executable; if a name is
    given without an absolute path the names of files in the bases subdirectory
    of the cx_Freeze package is searched

    #4
    target_name the name of the target executable; the default
    value is the name of the script; the extension is optional (automatically
    added on Windows); support for names with version; if specified a pathname, raise an error.

    #5
    icon name of icon which should be included in the
    executable itself on Windows or placed in the target directory for other platforms (ignored in Microsoft Store Python app)

    #6
    manifest name of manifest which should be included in
    the executable itself (Windows only - ignored by Python app from Microsoft Store)

    #7
    uac-admin creates a manifest for an application that will
    request elevation (Windows only - ignored by Python app from Microsoft
    Store)

    #8
    shortcut_name the name to give a shortcut for the executable
    when included in an MSI package (Windows only).

    #9
    shortcut_dir the directory in which to place the
    shortcut when being installed by an MSI package; see the MSI Shortcut table documentation for more information on what values can be placed here
    (Windows only).

    #10
    copyright the copyright value to include in the version
    resource associated with executable (Windows only).

    #11
    trademarks the trademarks value to include in the version
    resource associated with the executable (Windows only).
    """

    You are passing 13 .py file names. There are only two arguments that really want file names: script, and init_script. Most of the other
    arguments are either optional or Windows specific (#6-11).

    I suspect you need to pass JUST main.py or Maiui.py (based on casing) -- which ever is really the file you'd invoke to start the program running.
    I'd hope the freeze system then scans (recursively) that file to find
    anything imported, and include those in the final product.


    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Peter J. Holzer@21:1/5 to David at Booomer on Wed Aug 17 23:17:27 2022
    On 2022-08-17 12:09:14 -0600, David at Booomer wrote:
    Executable(
    "prjui.py","Maiui.py","about.py","dict.py","geometry.py","getEquation.py",
    "gtrail.py","main.py","matchingstring.py","producelatex.py","readfile.py",
    "separete.py","speak.py",
    )
    [...]
    I am/was worried about the trailing ‘,' after ',"speak.py”,’ <- but deleting it or moving it after the ] didn’t help.

    This has nothing to do with your problem but:

    Python allows a trailing comma in any comma-separated list of values. It
    will just be ignored.

    This is really common in modern programming languages (read: programming languages younger than 30 years or so), because it makes it much more convenient to extend/shorten/reorder a list. Otherwise you alway have to remember add or remove a comma in the right place. (Some people
    (especially SQL programmers for some reason) resorted to put the comma
    at the start of each line to get around this, which is really ugly.)

    hp

    --
    _ | Peter J. Holzer | Story must make more sense than reality.
    |_|_) | |
    | | | hjp@hjp.at | -- Charles Stross, "Creative writing
    __/ | http://www.hjp.at/ | challenge!"

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAmL9WuIACgkQ8g5IURL+ KF0KLw/9F6R7TbDbp/eNkkBb+xLny5ZuTKLUT7/yfbdUoCNQVXtVHa9BHcbXzoRP 30gqjAhJqcvkP7kBGAKQupUY7eT/cWuCrjHOW+KxqwKaAfgFSfc/j1tzhteAUCY0 7LbV7S8nGuCoY2vPFPfhtJjcPJrJrYkbA4+GZmoQSgwzzNFXQ3MT/a8hH2YhuhVh zI3GlGiv18tjkYDKDjULsNlMJNRonDJCQBZw9IP1+tBnJZkiJgsmy0mwLd1cMvml G3W4C3nWEzdBPvT3U+5Yc/4lLMNgjcGBVDXZori8LHamRCE38jn2qIWjGdC4UNzM 22ViLxDYg44m3Us9ibOg2vfLkiH6cDFFnv78mhiIHXleXSSJNzUPmmZYDPIPJkZ6 fuGvMy/N/cBYhCSd9uay9GdbJUejqnhe3OZFtXIFDQhBmrUED1e0t3XedjdsXKHX gmlrNwVxCd/0ibWvQeD+EAfSAZ/sa7C+bDkOHvr9j+qBGISK3F1lgG3Z4070I2mf 0vj/jdPigOR8/8SgseZ31BFozRCDE9xbyOAI6ePb+zfwz5ailCnzElo0rQAUaAqo FOs6KGb2yLrEPAZM8SWJV+qktE4Rz/q7I0gnnUCQM8AKIKxdAYLP/49QTdKebh8K boQLa2rc5DZS0pqKWvPnzXEa2hd3Of7MoClKoPH
  • From subin@21:1/5 to hjp-python@hjp.at on Fri Aug 19 01:00:04 2022
    Hope you had a good time.

    On Wed, Aug 17, 2022 at 10:19 PM Peter J. Holzer <hjp-python@hjp.at> wrote:

    On 2022-08-17 12:09:14 -0600, David at Booomer wrote:
    Executable(

    "prjui.py","Maiui.py","about.py","dict.py","geometry.py","getEquation.py",

    "gtrail.py","main.py","matchingstring.py","producelatex.py","readfile.py",
    "separete.py","speak.py",
    )
    [...]
    I am/was worried about the trailing ‘,' after ',"speak.py”,’ <- but deleting it or moving it after the ] didn’t help.

    This has nothing to do with your problem but:

    Python allows a trailing comma in any comma-separated list of values. It
    will just be ignored.

    This is really common in modern programming languages (read: programming languages younger than 30 years or so), because it makes it much more convenient to extend/shorten/reorder a list. Otherwise you alway have to remember add or remove a comma in the right place. (Some people
    (especially SQL programmers for some reason) resorted to put the comma
    at the start of each line to get around this, which is really ugly.)

    hp

    --
    _ | Peter J. Holzer | Story must make more sense than reality.
    |_|_) | |
    | | | hjp@hjp.at | -- Charles Stross, "Creative writing
    __/ | http://www.hjp.at/ | challenge!"
    --
    https://mail.python.org/mailman/listinfo/python-list


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)