Skip to content

Commit fix for issue #122 in oleksis/youtube-dl-gui #123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 22, 2023

Conversation

gitgeoff
Copy link

"Paste In URL Field Not Working" on Mac and Probably Linux
Fix logic for testing status of the clipboard, and implement fix for UNICODE per wxWidgets/Phoenix#2042

"Paste In URL Field Not Working"
Related to Mac and Probably Linux
Fix logic for testing status of the clipboard, and
implement fix for UNICODE per wxWidgets/Phoenix#2042
@sourcery-ai
Copy link

sourcery-ai bot commented Feb 20, 2023

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 0.01%.

Quality metrics Before After Change
Complexity 6.45 ⭐ 6.40 ⭐ -0.05 👍
Method Length 89.90 🙂 89.88 🙂 -0.02 👍
Working memory 10.79 😞 10.82 😞 0.03 👎
Quality 62.17% 🙂 62.16% 🙂 -0.01% 👎
Other metrics Before After Change
Lines 1315 1315 0
Changed files Quality Before Quality After Quality Change
youtube_dl_gui/mainframe.py 62.17% 🙂 62.16% 🙂 -0.01% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
youtube_dl_gui/mainframe.py MainFrame.__init__ 11 🙂 1311 ⛔ 28 ⛔ 23.92% ⛔ Try splitting into smaller methods. Extract out complex expressions
youtube_dl_gui/mainframe.py MainFrame._on_delete 32 😞 266 ⛔ 12 😞 26.08% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
youtube_dl_gui/mainframe.py MainFrame._on_timer 9 🙂 136 😞 15 😞 47.80% 😞 Try splitting into smaller methods. Extract out complex expressions
youtube_dl_gui/mainframe.py MainFrame._set_layout 0 ⭐ 391 ⛔ 8 🙂 55.45% 🙂 Try splitting into smaller methods
youtube_dl_gui/mainframe.py MainFrame._on_reload 12 🙂 129 😞 9 🙂 55.84% 🙂 Try splitting into smaller methods

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

@oleksis oleksis self-requested a review February 20, 2023 09:57
@oleksis
Copy link
Owner

oleksis commented Feb 20, 2023

@gitgeoff Can test the new changes for macOS. If work as expected we can merge

@oleksis oleksis added the bug Something isn't working label Feb 20, 2023
@gitgeoff
Copy link
Author

gitgeoff commented Feb 20, 2023

@gitgeoff Can test the new changes for macOS. If work as expected we can merge

@oleksis I have pulled your revision to my local copy but can't figure out how to test the local version on Mac. Do I go into youtube-dl-gui and run setup.sh? The build from source instructions in Readme.md feel disconnected from what I see locally.

@gitgeoff
Copy link
Author

@gitgeoff Can test the new changes for macOS. If work as expected we can merge

@oleksis I have pulled your revision to my local copy but can't figure out how to test the local version on Mac. Do I go into youtube-dl-gui and run setup.sh? The build from source instructions in Readme.md feel disconnected from what I see locally.

Specifically, I tried following the Install from Source instructions. Ran through getting the venv setup, then running make install results in an error:

WARNING: the legacy dependency resolver is deprecated and will be removed in future versions of pip-tools. The default resolver will be changed to 'backtracking' in pip-tools 7.0.0. Specify --resolver=backtracking to silence this warning.
    error: subprocess-exited-with-error
    
    × python setup.py egg_info did not run successfully.
    │ exit code: 1
    ╰─> [8 lines of output]
        Traceback (most recent call last):
          File "<string>", line 2, in <module>
          File "<pip-setuptools-caller>", line 34, in <module>
          File "/private/var/folders/ny/yz2ldzhd68148kd6jhyvzf100000gn/T/pip-resolver-dxy3ppwt/wxpython/setup.py", line 27, in <module>
            from buildtools.config import Config, msg, opj, runcmd, canGetSOName, getSOName
          File "/private/var/folders/ny/yz2ldzhd68148kd6jhyvzf100000gn/T/pip-resolver-dxy3ppwt/wxpython/buildtools/config.py", line 30, in <module>
            from attrdict import AttrDict
        ModuleNotFoundError: No module named 'attrdict'
        [end of output]

@gitgeoff
Copy link
Author

No module named 'attrdict'

Looks like the requirements.in method of including attrdict3 is not working. There is a comment in that file about a "fix" being added to include it. I tried running pip3 install attrdict3 and then running make install again and the install ran past the original fail point, but then still failed later:

  ERROR: Failed building wheel for wxpython
  Running setup.py clean for wxpython
Failed to build wxpython
Installing collected packages: polib, altgraph, pypubsub, pyinstaller-hooks-contrib, pillow, numpy, macholib, attrdict, wxpython, pyinstaller
  Running setup.py install for wxpython ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for wxpython did not run successfully.
  │ exit code: 1
  ╰─> [12 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/ny/yz2ldzhd68148kd6jhyvzf100000gn/T/pip-install-ri3v732f/wxpython_a9f00691641941f39c9630d6d588a2f8/setup.py", line 27, in <module>
          from buildtools.config import Config, msg, opj, runcmd, canGetSOName, getSOName
        File "/private/var/folders/ny/yz2ldzhd68148kd6jhyvzf100000gn/T/pip-install-ri3v732f/wxpython_a9f00691641941f39c9630d6d588a2f8/buildtools/config.py", line 30, in <module>
          from attrdict import AttrDict
        File "/Users/username/Desktop/ydl_gui/youtube-dl-gui/venv/lib/python3.11/site-packages/attrdict/__init__.py", line 5, in <module>
          from attrdict.mapping import AttrMap
        File "/Users/username/Desktop/ydl_gui/youtube-dl-gui/venv/lib/python3.11/site-packages/attrdict/mapping.py", line 4, in <module>
          from collections import Mapping
      ImportError: cannot import name 'Mapping' from 'collections' (/usr/local/Cellar/python@3.11/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/collections/__init__.py)
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

@oleksis
Copy link
Owner

oleksis commented Feb 21, 2023

When you active the virtual environment

source venv/bin/activate

After you need to install wxPython in the virtualenv before run yt-dlg

Specifically, I tried following the Install from Source instructions. Ran through getting the venv setup, then running make install results in an error:

WARNING: the legacy dependency resolver is deprecated and will be removed in future versions of pip-tools. The default resolver will be changed to 'backtracking' in pip-tools 7.0.0. Specify --resolver=backtracking to silence this warning.
    error: subprocess-exited-with-error
    
    × python setup.py egg_info did not run successfully.
    │ exit code: 1
    ╰─> [8 lines of output]
        Traceback (most recent call last):
          File "<string>", line 2, in <module>
          File "<pip-setuptools-caller>", line 34, in <module>
          File "/private/var/folders/ny/yz2ldzhd68148kd6jhyvzf100000gn/T/pip-resolver-dxy3ppwt/wxpython/setup.py", line 27, in <module>
            from buildtools.config import Config, msg, opj, runcmd, canGetSOName, getSOName
          File "/private/var/folders/ny/yz2ldzhd68148kd6jhyvzf100000gn/T/pip-resolver-dxy3ppwt/wxpython/buildtools/config.py", line 30, in <module>
            from attrdict import AttrDict
        ModuleNotFoundError: No module named 'attrdict'
        [end of output]

This is know issue for the last version wxPython 4.2.0

Install the requeriments

python3 -m pip install ./requirements/requirements.txt

Make sure install the requirements for compile wxPython with the version of Python you are using on macOS.

Then install yt-dlg from the clone repository

python3 -m pip install -e .

@gitgeoff
Copy link
Author

python3 -m pip install ./requirements/requirements.tx

Running python -m pip install -r requirements/requirements.in results in the same error.

@gitgeoff
Copy link
Author

python3 -m pip install ./requirements/requirements.tx

Running python -m pip install -r requirements/requirements.in results in the same error.

That is running in the venv.

@oleksis
Copy link
Owner

oleksis commented Feb 21, 2023

That is running in the venv.

Give a try to pyenv:

@oleksis
Copy link
Owner

oleksis commented Feb 21, 2023

I trying Oracle VM VirtualBox 7 and macOS Ventura and for hours stay in this screen ⏱️
image

@oleksis oleksis merged commit c8e3ed2 into oleksis:master Feb 22, 2023
@oleksis
Copy link
Owner

oleksis commented Feb 22, 2023

@gitgeoff Thanks for the contribution. Tested in the VM: macOS Ventura, Python 3.10.10, wxPython 4.2 . Give a try!

@oleksis oleksis removed their request for review February 22, 2023 04:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants