Addon Manager not working in Py3 build with metadata.txt

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
furti
Posts: 343
Joined: Mon Nov 27, 2017 5:27 pm

Addon Manager not working in Py3 build with metadata.txt

Postby furti » Mon Aug 27, 2018 7:49 pm

I tested the 0.18 Py3 build today and wanted to install Yoriks BIM Workbench. But it failed with the following error:

Code: Select all

No module named 'git'
GitPython not found. Using standard download instead.
Traceback (most recent call last):
  File "C:\Meine Daten\freecad\FreeCAD_0.18.14443_Conda_Py3QT5-WinVS2016_x64\Mod\AddonManager\AddonManager.py", line 958, in run
    depsok,answer = self.checkDependencies(self.repos[idx][1])
  File "C:\Meine Daten\freecad\FreeCAD_0.18.14443_Conda_Py3QT5-WinVS2016_x64\Mod\AddonManager\AddonManager.py", line 1013, in checkDependencies
    deps = depsfile.split("\n")
TypeError: a bytes-like object is required, not 'str'
Some googling brought me to the result that urllib2 gives you a bytestring and not a unicode string like in Python 2.7.

The fix for me was to append this code on line 1006 in AddonManager.py

Code: Select all

            # urllib2 gives us a bytelike object instead of a string. Have to account for that
            try:
                depsfile = depsfile.decode('utf-8')
            except AttributeError:
                pass
I have a Pretty bad Internet connection Right now. So i can't clone the FreeCAD repository and add the fix. Feel free to incorporate the code into FreeCAD. Otherwise i might create a pull request at the end of the week when my Internet connection will be better again :D


The FreeCAD Version i used:

Code: Select all

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.14442 (Git)
Build type: Release
Branch: master
Hash: bb9d737ba1158fdba5d06df45ab3e213065139cd
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Austria (de_AT)



Bugfix also testet in Version:

Code: Select all

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.13870 (Git)
Build type: Release
Branch: master
Hash: f0964a9c052ee666631cd9caec1655790964ecb6
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: German/Austria (de_AT)

TheMarkster
Posts: 2011
Joined: Thu Apr 05, 2018 1:53 am

Re: Addon Manager not working in Py3 build with metadata.txt

Postby TheMarkster » Mon Aug 27, 2018 8:03 pm

This will probably fix the issue I was having here:

https://forum.freecadweb.org/viewtopic. ... 76#p252190

with a different macro.
My FreeCAD video series on youtube: https://www.youtube.com/c/mwganson
User avatar
sgrogan
Posts: 6083
Joined: Wed Oct 22, 2014 5:02 pm

Re: Addon Manager not working in Py3 build with metadata.txt

Postby sgrogan » Mon Aug 27, 2018 10:26 pm

furti wrote:
Mon Aug 27, 2018 7:49 pm
No module named 'git' GitPython not found. Using standard download instead.
Thanks for this. I will fix this in the up-coming Conda based Win builds. It's independent from the Py3 issue, but it's a good reminder.
PY3 testing is great :)

EDIT: https://github.com/FreeCAD/FreeCAD/rele ... 016_x64.7z should fix the git part of the packaging. Do you have time to test furti?
"fight the good fight"
User avatar
looo
Posts: 3461
Joined: Mon Nov 11, 2013 5:29 pm

Re: Addon Manager not working in Py3 build with metadata.txt

Postby looo » Tue Aug 28, 2018 8:48 am

furti wrote:I have a Pretty bad Internet connection Right now. So i can't clone the FreeCAD repository and add the fix. Feel free to incorporate the code into FreeCAD. Otherwise i might create a pull request at the end of the week when my Internet connection will be better again :D
you can make changes to freecad also via github directly. simple browse to the file you want to edit, and press on the editing symbol on the top right (see image). The steps to create the PR are also intuitive...
Attachments
Bildschirmfoto vom 2018-08-28 10-43-32.png
Bildschirmfoto vom 2018-08-28 10-43-32.png (57.94 KiB) Viewed 772 times
User avatar
furti
Posts: 343
Joined: Mon Nov 27, 2017 5:27 pm

Re: Addon Manager not working in Py3 build with metadata.txt

Postby furti » Tue Aug 28, 2018 3:27 pm

sgrogan wrote:
Mon Aug 27, 2018 10:26 pm
Do you have time to test furti?
Downloaded the new build provided by you ( seems that the Internet connection is better earlier in the day when not everyone is Streaming in the hotel :D )
Now the git not found message is gone :)
addon_manager_py3.png
addon_manager_py3.png (7.36 KiB) Viewed 745 times
looo wrote:
Tue Aug 28, 2018 8:48 am
you can make changes to freecad also via github directly
Thanks for that hint. Don't work with the Github GUI that much so I didn't think about that :) Created a Pull Request to fix this issue now.
User avatar
furti
Posts: 343
Joined: Mon Nov 27, 2017 5:27 pm

Re: Addon Manager not working in Py3 build with metadata.txt

Postby furti » Tue Aug 28, 2018 3:52 pm

sgrogan wrote:
Mon Aug 27, 2018 10:26 pm
I will fix this in the up-coming Conda based Win builds.

Found one thing that looks like a bug with the git download method. When Installing the Dialog says cloning. Thats fine
addon_installation_1.png
addon_installation_1.png (9.43 KiB) Viewed 738 times
But when the Installation is finished there is no Information about it. The dialog simply returns to its initial state.
addon_installation_2.png
addon_installation_2.png (14.24 KiB) Viewed 738 times
After Reopening the Addon Manager (no FreeCAD restart needed) it Shows that the workbench is installed.
addon_installation_3.png
addon_installation_3.png (14.41 KiB) Viewed 738 times

There is also a icon missing for the "Check for updates" Button. :)


Tested with:

Code: Select all

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.14482 (Git)
Build type: Release
Branch: master
Hash: 6f06345634e25839b535a4534face9d9c1196201
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Austria (de_AT)

UR_
Posts: 1192
Joined: Tue Jan 03, 2017 8:42 pm

Re: Addon Manager not working in Py3 build with metadata.txt

Postby UR_ » Tue Aug 28, 2018 4:51 pm

sgrogan wrote:
Mon Aug 27, 2018 10:26 pm
EDIT: https://github.com/FreeCAD/FreeCAD/rele ... 016_x64.7z should fix the git part of the packaging. Do you have time to test furti?
using this build, i got following messages in report view:

Code: Select all

Failed to initialize: Bad git executable.
The git executable must be specified in one of the following ways:
    - be included in your $PATH
    - be set via $GIT_PYTHON_GIT_EXECUTABLE
    - explicitly set via git.refresh()

All git commands will error until this is rectified.

This initial warning can be silenced or aggravated in the future by setting the
$GIT_PYTHON_REFRESH environment variable. Use one of the following values:
    - quiet|q|silence|s|none|n|0: for no warning or exception
    - warn|w|warning|1: for a printed warning
    - error|e|raise|r|2: for a raised exception

Example:
    export GIT_PYTHON_REFRESH=quiet

GitPython not found. Using standard download instead.
Downloading https://github.com/tomate44/CurvesWB/archive/master.zip

:?: :?: :?:
UR_
Posts: 1192
Joined: Tue Jan 03, 2017 8:42 pm

Re: Addon Manager not working in Py3 build with metadata.txt

Postby UR_ » Tue Aug 28, 2018 5:17 pm

UR_ wrote:
Tue Aug 28, 2018 4:51 pm
Failed to initialize: Bad git executable.
Sorry for that false positive, just didn't realize that git wasn't installed on machine I used for testing :oops:
UR_
Posts: 1192
Joined: Tue Jan 03, 2017 8:42 pm

Re: Addon Manager not working in Py3 build with metadata.txt

Postby UR_ » Tue Aug 28, 2018 5:26 pm

furti wrote:
Tue Aug 28, 2018 3:52 pm
But when the Installation is finished there is no Information about it.
If you try to update a already installed WB, you will get lost in a endless loop :(
and you have to leave addon manager by [close] button and reinvoke it to continue :(
TheMarkster
Posts: 2011
Joined: Thu Apr 05, 2018 1:53 am

Re: Addon Manager not working in Py3 build with metadata.txt

Postby TheMarkster » Tue Aug 28, 2018 5:29 pm

UR_ wrote:
Tue Aug 28, 2018 5:17 pm
UR_ wrote:
Tue Aug 28, 2018 4:51 pm
Failed to initialize: Bad git executable.
Sorry for that false positive, just didn't realize that git wasn't installed on machine I used for testing :oops:
No, that's still a great report. I think most users will not have git installed, especially not on Windows.
My FreeCAD video series on youtube: https://www.youtube.com/c/mwganson