Giter Site home page Giter Site logo

Comments (14)

wasbeer avatar wasbeer commented on August 30, 2024 1

The following steps resulted in a working app for me:

  1. Make sure you install python via pyenv with the following flag (to get the dylib):
    env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.7.4

  2. Delete the setup.py and make a new one
    py2applet --make-setup radiobar.py

  3. Build the app using py2app
    python -i setup.py py2app

from radiobar.

mdbraber avatar mdbraber commented on August 30, 2024

This seems like an error with py2app. I'm not at my computer right now, but I'll investigate later. It could also help to report this error to the py2app developers.

from radiobar.

steveharman avatar steveharman commented on August 30, 2024

Thanks @mdbraber - I just updated my ticket with a little more detail.

from radiobar.

mdbraber avatar mdbraber commented on August 30, 2024

@steveharman are you possibly using PYTHONPATH to specific modules? If so you should use the --use-pythonpath option like described here: https://py2app.readthedocs.io/en/latest/options.html

from radiobar.

mdbraber avatar mdbraber commented on August 30, 2024

@steveharman here's an approach to debug Python issues:

This is a general guide to debugging setup.py issues, or actually python issues in general (copied from: https://stackoverflow.com/questions/16131500/py2app-error-in-find-needed-modules-typeerror-nonetype-object-has-no-attribu)

  1. Run it again in interactive mode, i.e. python3 -i setup.py py2app. Once setup.py exits you will find yourself in a python prompt.
  2. Run from pdb import pm; pm(). You should now find yourself at a debug prompt.
  3. Type up and hit enter - you are now a frame higher in the stack - you can type list to see where in the source code the current frame is positioned, and args to see the arguments passed to the current frame (usually a function or method). You can also run python commands to inspect the current state, and run pp var to pretty-print that variable.
  4. Once you have repeated the above step a few times you will find where the error is encountered - in the case I encountered where it was a README file I found a variable called lineno which gave the line of my README file which caused the error. If your problem is a module import, it'll probably be something different, but my instinct is that you'll find yourself looping over the packages argument seen in your stack trace, and the current list item will be the key to your problem.

from radiobar.

steveharman avatar steveharman commented on August 30, 2024

I'm really sorry @mdbraber I simply don't have time to go into resolving this right now. I've never knowingly touched Python before, I just wanted a menubar radio app for my Mac. ;-)

from radiobar.

mdbraber avatar mdbraber commented on August 30, 2024

@steveharman unfortunately as I can't reproduce the issue it might be due to your local environment. I'll try to investigate a bit more and see if I can reproduce. One question: did you install python3 using brew?

from radiobar.

steveharman avatar steveharman commented on August 30, 2024

perfectly understood @mdbraber

and yes to python3 via brew

happy to help debug if there are some quickfire "do this, try this, let me know" steps.

from radiobar.

steveharman avatar steveharman commented on August 30, 2024

Hi @mdbraber

I tried the steps you mentioned, here's my output:

running py2app
creating /Users/steveharman/radiobar/build/bdist.macosx-10.14-x86_64/python3.7-standalone/app
creating /Users/steveharman/radiobar/build/bdist.macosx-10.14-x86_64/python3.7-standalone/app/collect
creating /Users/steveharman/radiobar/build/bdist.macosx-10.14-x86_64/python3.7-standalone/app/temp
creating build/bdist.macosx-10.14-x86_64/python3.7-standalone/app/lib-dynload
creating build/bdist.macosx-10.14-x86_64/python3.7-standalone/app/Frameworks
Traceback (most recent call last):
  File "setup.py", line 26, in <module>
    setup_requires=['py2app'],
  File "/usr/local/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python3.7/site-packages/py2app/build_app.py", line 838, in run
    self._run()
  File "/usr/local/lib/python3.7/site-packages/py2app/build_app.py", line 1053, in _run
    self.run_normal()
  File "/usr/local/lib/python3.7/site-packages/py2app/build_app.py", line 1146, in run_normal
    mf = self.get_modulefinder()
  File "/usr/local/lib/python3.7/site-packages/py2app/build_app.py", line 997, in get_modulefinder
    debug=debug,
  File "/usr/local/lib/python3.7/site-packages/modulegraph/find_modules.py", line 338, in find_modules
    find_needed_modules(mf, scripts, includes, packages)
  File "/usr/local/lib/python3.7/site-packages/modulegraph/find_modules.py", line 256, in find_needed_modules
    path = m.packagepath[0]
TypeError: 'NoneType' object is not subscriptable
>>> from pdb import pm; pm()
> /usr/local/lib/python3.7/site-packages/modulegraph/find_modules.py(256)find_needed_modules()
-> path = m.packagepath[0]
(Pdb) up
> /usr/local/lib/python3.7/site-packages/modulegraph/find_modules.py(338)find_modules()
-> find_needed_modules(mf, scripts, includes, packages)
(Pdb) list
333  	        path=path,
334  	        excludes=(excludes - includes),
335  	        implies=get_implies(),
336  	        debug=debug,
337  	    )
338  ->	    find_needed_modules(mf, scripts, includes, packages)
339  	    return mf
[EOF]
(Pdb)```

Afraid I have no knowledge of "PYTHONPATH".

Steve

from radiobar.

steveharman avatar steveharman commented on August 30, 2024

Could you explain how I accomplish item 1 in your list of steps please @wasbeer ?

Thanks

from radiobar.

steveharman avatar steveharman commented on August 30, 2024

I come bak to this from time to time, to see if the errors I have go away, but I think this is y final attempt.

  • Fresh install of macOS
  • Fresh install of python3
  • Fresh install of vlc
  • Fresh clone of the code [master]

And I get:

python3 setup.py py2app
running py2app
creating /Users/steveharman/radiobar/build/bdist.macosx-10.15-x86_64/python3.7-standalone
creating /Users/steveharman/radiobar/build/bdist.macosx-10.15-x86_64/python3.7-standalone/app
creating /Users/steveharman/radiobar/build/bdist.macosx-10.15-x86_64/python3.7-standalone/app/collect
creating /Users/steveharman/radiobar/build/bdist.macosx-10.15-x86_64/python3.7-standalone/app/temp
creating build/bdist.macosx-10.15-x86_64/python3.7-standalone/app/lib-dynload
creating build/bdist.macosx-10.15-x86_64/python3.7-standalone/app/Frameworks
Traceback (most recent call last):
  File "setup.py", line 26, in <module>
    setup_requires=['py2app'],
  File "/usr/local/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/Users/steveharman/radiobar/.eggs/py2app-0.19-py3.7.egg/py2app/build_app.py", line 838, in run
    self._run()
  File "/Users/steveharman/radiobar/.eggs/py2app-0.19-py3.7.egg/py2app/build_app.py", line 1053, in _run
    self.run_normal()
  File "/Users/steveharman/radiobar/.eggs/py2app-0.19-py3.7.egg/py2app/build_app.py", line 1146, in run_normal
    mf = self.get_modulefinder()
  File "/Users/steveharman/radiobar/.eggs/py2app-0.19-py3.7.egg/py2app/build_app.py", line 997, in get_modulefinder
    debug=debug,
  File "/Users/steveharman/radiobar/.eggs/modulegraph-0.17-py3.7.egg/modulegraph/find_modules.py", line 338, in find_modules
    find_needed_modules(mf, scripts, includes, packages)
  File "/Users/steveharman/radiobar/.eggs/modulegraph-0.17-py3.7.egg/modulegraph/find_modules.py", line 256, in find_needed_modules
    path = m.packagepath[0]
TypeError: 'NoneType' object is not subscriptable

from radiobar.

mdbraber avatar mdbraber commented on August 30, 2024

@steveharman did you try pip3 install modulegraph?

from radiobar.

steveharman avatar steveharman commented on August 30, 2024

I don't know what modulegraph is but I used pip3 to install py2app. Is it relevant that I never get any success with the shortened version of py2app from terminal, only the full py2applet command

➜  radiobar git:(master) py2applet

usage: py2applet --make-setup [options...] script.py [data files...]
   or: py2applet [options...] script.py [data files...]
   or: py2applet --help

➜  radiobar git:(master) py2app
zsh: command not found: py2app
➜  radiobar git:(master)

from radiobar.

mdbraber avatar mdbraber commented on August 30, 2024

py2app is not an independent command afaik (you run it through python setup.py py2app. py2applet is an independent command so what you have looks okay. I'm guessing it's some kind of versioning problem. Can you try installing the dev versions of the modules as mentioned here: https://mail.python.org/pipermail/pythonmac-sig/2008-September/020471.html

easy_install -U modulegraph==dev
easy_install -U py2app==dev

from radiobar.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.