toolmanager bombed out , all tools gone.

Here's the place for discussion related to CAM/CNC and the development of the Path module.
User avatar
freman
Posts: 674
Joined: Tue Nov 27, 2018 10:30 pm

toolmanager bombed out , all tools gone.

Postby freman » Sun Oct 06, 2019 4:47 pm

I've found what looks to be another py2/py3 issue :

Currently renders FreeCAD unusable on py2 build.

I just tried to add a new tool ( 14 were already defined ). I filled in all the fields and pressed OK.

Several lines of red errors appeared in the report view, the last one something about Unicode and not being able to get a result. I cleared the report window and went around again to see what may be wrong with the new tool.

Surprise !! No tools at all . Blank.

I closed project file without saving and reopened , hoping to find the previous tools. Zip. I opened an older backup of the file : same result. No tools!

It looks like I still have the currently used tools in the FCStd but the toolmanager does not even have those one left. My backups of FCStd files are not sufficient. This presumably is ( was ) in home directory. :(

I find this on console:

Code: Select all

Traceback (most recent call last):
  File "/~/freecad19-master-build/Mod/Path/PathScripts/PathToolLibraryEditor.py", line 110, in addTool
    self.TLM.addnew(listname, editor.Tool)
  File "/~/freecad19-master-build/Mod/Path/PathScripts/PathToolLibraryManager.py", line 457, in addnew
    self.saveMainLibrary()
  File "/~/freecad19-master-build/Mod/Path/PathScripts/PathToolLibraryManager.py", line 308, in saveMainLibrary
    self.loadToolTables()
  File "/~/freecad19-master-build/Mod/Path/PathScripts/PathToolLibraryManager.py", line 298, in loadToolTables
    tt = self.tooltableFromAttrs(table)
  File "/~/freecad19-master-build/Mod/Path/PathScripts/PathToolLibraryManager.py", line 252, in tooltableFromAttrs
    tt.Name = stringattrs.get('TableName')
TypeError: cannot return std::string from Unicode object
I suspect an untrapped error in the new tool name. This should not have blown away my entire toolmanager contents.

What files do I need to back up home dir?

If I now try to add a new tool table using the "+" icon I get the same errors shown above.

Now if I go to Path | Toolmanger, I don't even get the GUI and it spews errors in report window:

Code: Select all

Path workbench activated
Running the Python command 'Path_ToolLibraryEdit' failed:
Traceback (most recent call last):
  File "/svn/freecad19-master-build/Mod/Path/PathScripts/PathToolLibraryEditor.py", line 460, in Activated
    self.edit()
  File "/svn/freecad19-master-build/Mod/Path/PathScripts/PathToolLibraryEditor.py", line 442, in edit
    editor = EditorPanel(job, cb)
  File "/svn/freecad19-master-build/Mod/Path/PathScripts/PathToolLibraryEditor.py", line 48, in __init__
    self.TLM = ToolLibraryManager.ToolLibraryManager()
  File "/svn/freecad19-master-build/Mod/Path/PathScripts/PathToolLibraryManager.py", line 158, in __init__
    self.loadToolTables()
  File "/svn/freecad19-master-build/Mod/Path/PathScripts/PathToolLibraryManager.py", line 298, in loadToolTables
    tt = self.tooltableFromAttrs(table)
  File "/svn/freecad19-master-build/Mod/Path/PathScripts/PathToolLibraryManager.py", line 252, in tooltableFromAttrs
    tt.Name = stringattrs.get('TableName')

cannot return std::string from Unicode object
This is a mess. How can I get back to a state where I can enter tools and repair the damage ?

TIA.


OS: Linux (LXDE/LXDE)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18272 (Git)
Build type: Unknown
Branch: master
Hash: 88637aeb202b481a16cbd82c8767a0cc2745cfe1
Python version: 2.7.16
Qt version: 4.8.7


same happening of fresh pull of master.

Looks like more py3 stuff not tested on py2.
chrisb
Posts: 18991
Joined: Tue Mar 17, 2015 9:14 am

Re: toolmanager bombed out , all tools gone.

Postby chrisb » Mon Oct 07, 2019 12:43 am

freman wrote:
Sun Oct 06, 2019 4:47 pm
This is a mess. How can I get back to a state where I can enter tools and repair the damage ?
The tool library is stored in the user.cfg.

Furthermore I recommend to export the library.
User avatar
freman
Posts: 674
Joined: Tue Nov 27, 2018 10:30 pm

Re: toolmanager bombed out , all tools gone.

Postby freman » Mon Oct 07, 2019 1:24 am

Thanks for the reply. Sadly that file has no tool definitions. Looks like I've been bombed out by this bug.

Equally, I no longer have anything to export. I have no library at all and it is impossible to create a new one. My FC build is useless.

Again this highlights the need for basic testing on a python2 build. Folks messing with code using only python3 are breaking stuff.

I tried to make a py3 build but it fails cmake.

Code: Select all

cmake -DPYTHON_EXECUTABLE=/usr/bin/python3 ../freecad-source

.....

CMake Error at cMake/FreeCAD_Helpers/SetupQt.cmake:72 (find_package):
  By not providing "FindQt5UiTools.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Qt5UiTools", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5UiTools" with
  any of the following names:

    Qt5UiToolsConfig.cmake
    qt5uitools-config.cmake

This would seem to be about qttools but I already have these pkgs installed:

Code: Select all

Package qt5-qttools-devel-5.11.3-1.fc29.x86_64 is already installed.
Package qt5-qttools-5.11.3-1.fc29.x86_64 is already installed.
Any idea how I can fix that, is there another package I'm missing?
thx.
Last edited by freman on Mon Oct 07, 2019 1:37 am, edited 1 time in total.
vocx
Posts: 1687
Joined: Thu Oct 18, 2018 9:18 pm

Re: toolmanager bombed out , all tools gone.

Postby vocx » Mon Oct 07, 2019 1:37 am

freman wrote:
Mon Oct 07, 2019 1:24 am
...
Again this highlights the need for basic testing on python2 build. Folks messing with code using only python3 are breaking stuff.
...
Without really knowing what is causing this problem, the reality is that Python 2 is on its way out. You will hardly find a developer that wants to retain Python 2 compatibility. Some fixes are done as long as they are simple, but otherwise most people will just go with Python 3. Eventually support for Python 2 will completely end, and there won't be an alternative but to use an old FreeCAD version. That's just how it is.

https://pythonclock.org/
mlampert
Posts: 1342
Joined: Fri Sep 16, 2016 9:28 pm

Re: toolmanager bombed out , all tools gone.

Postby mlampert » Mon Oct 07, 2019 2:18 am

freman wrote:
Mon Oct 07, 2019 1:24 am
Again this highlights the need for basic testing on a python2 build. Folks messing with code using only python3 are breaking stuff.
As vocx already said, those days are gone. IMHO there is really no point in doing anything for py2 or qt4 in the 0.19 development. The major focus for 0.18 was to become py3 and qt5 compatible because the older versions are practically obsolete.

Code: Select all

cmake -DPYTHON_EXECUTABLE=/usr/bin/python3 ../freecad-source
I also specified -DBUILD_QT5=ON - not sure if it's the default now.
Any idea how I can fix that, is there another package I'm missing?
I just setup a new VM and followed this guide, worked flawlessly (for Debian):
https://www.freecadweb.org/wiki/CompileOnUnix


As for your tools, the default tool library is stored in your FC settings. You can look at "Tools" -> "Edit Parameters ..." -> "Preferences" -> "Mod" -> "Path". If there is a "ToolLibrary-Main" entry, then the value is your json formatted tool library. If there is nothing there then it's really gone, unless you exported it at some point.
User avatar
freman
Posts: 674
Joined: Tue Nov 27, 2018 10:30 pm

Re: toolmanager bombed out , all tools gone.

Postby freman » Mon Oct 07, 2019 6:56 am

thanks for the replies. If that is the state for python2 then the default build should be python3. I never had any need or reason to prefer py2, I just used the default build.

I'm now building with py3. However, I am unable to get through cmake with -DBUILD_QT5=ON ( no it's not default ).

I get the same error I posted above. The reason I got that error without specifying QT5 is that I had previously attempted py3/qt5 and it similarly failed. I had presumed that running cmake with different options would reconfigure for new options, it did not. I had to rm -rf and re-run py3/qt4 config. That is nearly done. Hopefully I will then be able to re-enter my tool table.

Obviously I need to be able to build with QT5 , so any help on what may be missing would be helpful. Googling the errors seemed to indicate qttools et al but already have those installed. Any ideas on what is missing?

thx
User avatar
freman
Posts: 674
Joined: Tue Nov 27, 2018 10:30 pm

Re: toolmanager bombed out , all tools gone.

Postby freman » Mon Oct 07, 2019 8:34 am

new py3/qt4 build falls on it's arse before it even starts.

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
#0  /lib64/libc.so.6(+0x38600) [0x7f6a6db43600]
#1  /lib64/libpython2.7.so.1.0(Py_InitModule4_64+0x42) [0x7f6a6a69ce42]
#2  /usr/lib64/python3.7/site-packages/PySide/QtCore.so(PyInit_QtCore+0x4f) [0x7f6a5a8b2ddf]
#3  /lib64/libpython3.7m.so.1.0(_PyImport_LoadDynamicModuleWithSpec+0x182) [0x7f6a7244e382]
#4  /lib64/libpython3.7m.so.1.0(+0x22469e) [0x7f6a7244e69e]
#5  /lib64/libpython3.7m.so.1.0(_PyMethodDef_RawFastCallDict+0x2f7) [0x7f6a7235d8d7]
#6  /lib64/libpython3.7m.so.1.0(_PyCFunction_FastCallDict+0x20) [0x7f6a7235d9c0]
#7  /lib64/libpython3.7m.so.1.0(_PyEval_EvalFrameDefault+0x6486) [0x7f6a723e9b26]
#8  /lib64/libpython3.7m.so.1.0(_PyEval_EvalCodeWithName+0x2f8) [0x7f6a7233ad38]
It seems it is not fully using py3. Maybe I need to rebuild pivy and the other dependency libs too.

Looks like I can forget using FreeCAD this week. :(
chrisb
Posts: 18991
Joined: Tue Mar 17, 2015 9:14 am

Re: toolmanager bombed out , all tools gone.

Postby chrisb » Mon Oct 07, 2019 8:44 am

Now, as this became rather a compile topic, should I move it to Compile/Install forum? I'm afraid that mainly the Path gurus watch the Path forum.
User avatar
freman
Posts: 674
Joined: Tue Nov 27, 2018 10:30 pm

Re: toolmanager bombed out , all tools gone.

Postby freman » Mon Oct 07, 2019 8:49 am

yes, sorry for the mission creep.

Since the response to the initial problem seems to be WONTFIX, even though it completely borks FreeCAD and makes it unusable on py2 builds, this will not go any further. However, the existence of this issue and it's "resolution" should probably remain here for the record.

I will open a new thread about my complier issues in the appropriate forum.

thx
vocx
Posts: 1687
Joined: Thu Oct 18, 2018 9:18 pm

Re: toolmanager bombed out , all tools gone.

Postby vocx » Mon Oct 07, 2019 5:48 pm

freman wrote:
Mon Oct 07, 2019 6:56 am
...Googling the errors seemed to indicate qttools et al but already have those installed. Any ideas on what is missing?
Compiling requires you to install many dependencies, not only one qttools package. See again CompileOnUnix.