[Bug] FreeCAD headless running 'modules freecad' crashes console

Need help, or want to share a macro? Post here!
User avatar
Kunda1
Posts: 6427
Joined: Thu Jan 05, 2017 9:03 pm

[Bug] FreeCAD headless running 'modules freecad' crashes console

Postby Kunda1 » Wed Oct 30, 2019 5:55 pm

Using FreeCAD_0.19-18614-Linux-Conda_Py3Qt5_glibc2.12-x86_64.AppImage

How to recreate:

1. freecadcmd -c
2. help()
3. modules freecad

Example:

Code: Select all

$ freecadcmd -c
[FreeCAD Console mode <Use Ctrl-D (i.e. EOF) to exit.>]
>>> help()

Welcome to Python 3.7's help utility!

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at https://docs.python.org/3.7/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, symbols, or topics, type
"modules", "keywords", "symbols", or "topics".  Each module also comes
with a one-line summary of what it does; to list the modules whose name
or summary contain a given string such as "spam", type "modules spam".

help> modules freecad

Here is a list of modules whose name or summary contains 'freecad'.
If there are any, enter a module name to get more help.

FreeCAD - The functions in the FreeCAD module allow working with documents.
__FreeCADBase__ - The Base module contains the classes for the geometric basics
InitGui - TabBar widget for FreeCAD.
TabBar_Gui - TabBar widget for FreeCAD.
BimCommands - This module contains FreeCAD commands for the BIM workbench
BimCurtainWall - This module contains FreeCAD commands for the BIM workbench
BimDiff - This module contains FreeCAD commands for the BIM workbench
BimIfcElements - This module contains FreeCAD commands for the BIM workbench
BimIfcProperties - This module contains FreeCAD commands for the BIM workbench
BimIfcQuantities - This module contains FreeCAD commands for the BIM workbench
BimLayers - Layers manager for FreeCAD
BimMaterial - This module contains FreeCAD commands for the BIM workbench
BimNudge - This module contains FreeCAD commands for the BIM workbench
BimPreflight - This module contains FreeCAD commands for the BIM workbench
BimProject - This module contains FreeCAD commands for the BIM workbench
BimReextrude - This module contains FreeCAD commands for the BIM workbench
BimSetup - This module contains FreeCAD commands for the BIM workbench
BimUnclone - This module contains FreeCAD commands for the BIM workbench
BimViews - This module contains FreeCAD commands for the BIM workbench
BimWelcome - This module contains FreeCAD commands for the BIM workbench.
BimWindows - This module contains FreeCAD commands for the BIM workbench
IconThemesGui - Icon themes for FreeCAD.
IconThemesLegacy - Icon themes for FreeCAD.
NavigationIndicatorGui - Navigation indicator for FreeCAD.
PersistentToolbars - Persistent toolbars for FreeCAD.
PersistentToolbarsGui - Persistent toolbars for FreeCAD.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/beast/bin/squashfs-root/usr/lib/python3.7/_sitebuiltins.py", line 103, in __call__
    return pydoc.help(*args, **kwds)
  File "/home/beast/bin/squashfs-root/usr/lib/python3.7/pydoc.py", line 1896, in __call__
    self.interact()
  File "/home/beast/bin/squashfs-root/usr/lib/python3.7/pydoc.py", line 1923, in interact
    self.help(request)
  File "/home/beast/bin/squashfs-root/usr/lib/python3.7/pydoc.py", line 1942, in help
    self.listmodules(request.split()[1])
  File "/home/beast/bin/squashfs-root/usr/lib/python3.7/pydoc.py", line 2078, in listmodules
    apropos(key)
  File "/home/beast/bin/squashfs-root/usr/lib/python3.7/pydoc.py", line 2172, in apropos
    ModuleScanner().run(callback, key, onerror=onerror)
  File "/home/beast/bin/squashfs-root/usr/lib/python3.7/pydoc.py", line 2133, in run
    loader = spec.loader
AttributeError: 'NoneType' object has no attribute 'loader'
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
Kunda1
Posts: 6427
Joined: Thu Jan 05, 2017 9:03 pm

Re: [Bug] FreeCAD headless running 'modules freecad' crashes console

Postby Kunda1 » Wed Oct 30, 2019 6:25 pm

It worked on 0.18.4
3.7.4 (default, Oct 4 2019, 06:57:26)
[GCC 9.2.0]

Code: Select all

$ freecadcmd --version
FreeCAD 0.18 Revision: 16145 (Git)
$ freecadcmd -c
FreeCAD 0.18, Libs: 0.18R16145 (Git)
(c) Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2019
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

[FreeCAD Console mode <Use Ctrl-D (i.e. EOF) to exit.>]
>>> import sys
>>> print(sys.version)
3.7.4 (default, Oct  4 2019, 06:57:26) 
[GCC 9.2.0]
>>> help()

Welcome to Python 3.7's help utility!

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at https://docs.python.org/3.7/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, symbols, or topics, type
"modules", "keywords", "symbols", or "topics".  Each module also comes
with a one-line summary of what it does; to list the modules whose name
or summary contain a given string such as "spam", type "modules spam".

help> modules freecad

Here is a list of modules whose name or summary contains 'freecad'.
If there are any, enter a module name to get more help.

FreeCAD - The functions in the FreeCAD module allow working with documents.
__FreeCADBase__ - The Base module contains the classes for the geometric basics
InitGui - TabBar widget for FreeCAD.
TabBar_Gui - TabBar widget for FreeCAD.
BimCommands - This module contains FreeCAD commands for the BIM workbench
BimCurtainWall - This module contains FreeCAD commands for the BIM workbench
BimDiff - This module contains FreeCAD commands for the BIM workbench
BimIfcElements - This module contains FreeCAD commands for the BIM workbench
BimIfcProperties - This module contains FreeCAD commands for the BIM workbench
BimIfcQuantities - This module contains FreeCAD commands for the BIM workbench
BimLayers - Layers manager for FreeCAD
BimMaterial - This module contains FreeCAD commands for the BIM workbench
BimNudge - This module contains FreeCAD commands for the BIM workbench
BimPreflight - This module contains FreeCAD commands for the BIM workbench
BimProject - This module contains FreeCAD commands for the BIM workbench
BimReextrude - This module contains FreeCAD commands for the BIM workbench
BimSetup - This module contains FreeCAD commands for the BIM workbench
BimUnclone - This module contains FreeCAD commands for the BIM workbench
BimViews - This module contains FreeCAD commands for the BIM workbench
BimWelcome - This module contains FreeCAD commands for the BIM workbench.
BimWindows - This module contains FreeCAD commands for the BIM workbench
IconThemesGui - Icon themes for FreeCAD.
IconThemesLegacy - Icon themes for FreeCAD.
NavigationIndicatorGui - Navigation indicator for FreeCAD.
PersistentToolbars - Persistent toolbars for FreeCAD.
PersistentToolbarsGui - Persistent toolbars for FreeCAD.
importJSON - FreeCAD JSON exporter
importWebGL - FreeCAD webgl exporter
FreeCAD 
FreeCADGui 
libFreeCADApp 
libFreeCADBase 
libFreeCADGui 
freecad 
/home/foo/.local/lib/python3.7/site-packages/astroid/interpreter/_import/spec.py:12: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
/home/foo/.local/lib/python3.7/site-packages/isort/pie_slice.py:362: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
/usr/lib/python3.7/site-packages/IPython/kernel/__init__.py:13: ShimWarning: The `IPython.kernel` package has been deprecated since IPython 4.0.You should import from ipykernel or jupyter_client instead.
/usr/lib/python3.7/pkgutil.py:92: RemovedInDjango30Warning: The django.db.backends.postgresql_psycopg2 module is deprecated in favor of django.db.backends.postgresql.
/usr/lib/python3.7/site-packages/iptc/util.py:39: ResourceWarning: unclosed file <_io.BufferedReader name=16>
/usr/lib/python3.7/site-packages/iptc/util.py:44: ResourceWarning: unclosed file <_io.TextIOWrapper name='/proc/sys/kernel/modprobe' mode='r' encoding='UTF-8'>
/usr/lib/python3.7/site-packages/iptc/util.py:39: ResourceWarning: unclosed file <_io.BufferedReader name=16>
/usr/lib/python3.7/site-packages/iptc/util.py:44: ResourceWarning: unclosed file <_io.TextIOWrapper name='/proc/sys/kernel/modprobe' mode='r' encoding='UTF-8'>
/usr/lib/python3.7/site-packages/kamene/data.py:62: ResourceWarning: unclosed file <_io.TextIOWrapper name='/etc/protocols' mode='r' encoding='UTF-8'>
/usr/lib/python3.7/site-packages/menulibre/MenulibreTreeview.py:36: PyGIDeprecationWarning: GObject.SIGNAL_RUN_LAST is deprecated; use GObject.SignalFlags.RUN_LAST instead
/usr/lib/python3.7/site-packages/menulibre/MenulibreTreeview.py:38: PyGIDeprecationWarning: GObject.SIGNAL_RUN_LAST is deprecated; use GObject.SignalFlags.RUN_LAST instead
/usr/lib/python3.7/site-packages/menulibre/MenulibreHistory.py:29: PyGIDeprecationWarning: GObject.SIGNAL_RUN_LAST is deprecated; use GObject.SignalFlags.RUN_LAST instead
/usr/lib/python3.7/site-packages/menulibre/MenulibreHistory.py:31: PyGIDeprecationWarning: GObject.SIGNAL_RUN_LAST is deprecated; use GObject.SignalFlags.RUN_LAST instead
/usr/lib/python3.7/site-packages/menulibre/MenulibreHistory.py:33: PyGIDeprecationWarning: GObject.SIGNAL_RUN_LAST is deprecated; use GObject.SignalFlags.RUN_LAST instead
/usr/lib/python3.7/site-packages/menulibre/MenulibreApplication.py:209: PyGIDeprecationWarning: GObject.SIGNAL_RUN_FIRST is deprecated; use GObject.SignalFlags.RUN_FIRST instead
/usr/lib/python3.7/site-packages/menulibre/MenulibreApplication.py:211: PyGIDeprecationWarning: GObject.SIGNAL_RUN_FIRST is deprecated; use GObject.SignalFlags.RUN_FIRST instead
/usr/lib/python3.7/site-packages/menulibre/MenulibreApplication.py:213: PyGIDeprecationWarning: GObject.SIGNAL_RUN_FIRST is deprecated; use GObject.SignalFlags.RUN_FIRST instead
/usr/lib/python3.7/site-packages/micawber/contrib/mcdjango/__init__.py:1: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
/usr/lib/python3.7/site-packages/gi/types.py:220: Warning: cannot register existing type 'Window'
/usr/lib/python3.7/site-packages/gi/types.py:220: Warning: cannot register existing type 'Window'
/home/foo/.local/lib/python3.7/site-packages/logbook/more.py:41: DeprecationWarning: Flags not at the start of the expression '(\\s+)(?u)'
[2019-10-30T17:56:51Z] WARNING: DependencyWarning: /home/foo/.FreeCAD/Mod/WebTools/requests/packages/urllib3/contrib/socks.py:37: SOCKS support in urllib3 requires the installation of optional dependencies: specifically, PySocks.  For more information, see https://urllib3.readthedocs.io/en/latest/contrib.html#socks-proxies
[2019-10-30T17:56:51Z] WARNING: DeprecationWarning: /usr/lib/python3.7/site-packages/pipenv/vendor/cerberus/validator.py:14: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
[2019-10-30T17:56:52Z] WARNING: RequestsDependencyWarning: /usr/lib/python3.7/site-packages/pipenv/vendor/requests/__init__.py:91: urllib3 (1.25.6) or chardet (3.0.4) doesn't match a supported version!
[2019-10-30T17:56:53Z] WARNING: DeprecationWarning: /usr/lib/python3.7/site-packages/qgis/core/__init__.py:121: invalid escape sequence \s
[2019-10-30T17:56:53Z] WARNING: DeprecationWarning: /usr/lib/python3.7/site-packages/qgis/core/additions/qgsfunction.py:167: invalid escape sequence \*
[2019-10-30T17:56:59Z] WARNING: wxPyDeprecationWarning: /usr/lib/python3.7/site-packages/wx/lib/pubsub/__init__.py:25: wx.lib.pubsub has been deprecated, plese migrate your code to use pypubsub, available on PyPI.
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
Kunda1
Posts: 6427
Joined: Thu Jan 05, 2017 9:03 pm

Re: [Bug] FreeCAD headless running 'modules freecad' crashes console

Postby Kunda1 » Thu Oct 31, 2019 3:37 pm

Can anyone confirm ?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
chrisb
Posts: 21375
Joined: Tue Mar 17, 2015 9:14 am

Re: [Bug] FreeCAD headless running 'modules freecad' crashes console

Postby chrisb » Thu Oct 31, 2019 3:44 pm

Does it work without any Addon installed?
User avatar
Kunda1
Posts: 6427
Joined: Thu Jan 05, 2017 9:03 pm

Re: [Bug] FreeCAD headless running 'modules freecad' crashes console

Postby Kunda1 » Thu Oct 31, 2019 5:39 pm

chrisb wrote:
Thu Oct 31, 2019 3:44 pm
Does it work without any Addon installed?
Removed all addons, and crash still occurs
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
Kunda1
Posts: 6427
Joined: Thu Jan 05, 2017 9:03 pm

Re: [Bug] FreeCAD headless running 'modules freecad' crashes console

Postby Kunda1 » Fri Nov 01, 2019 1:40 pm

Anyone able to reproduce?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
chrisb
Posts: 21375
Joined: Tue Mar 17, 2015 9:14 am

Re: [Bug] FreeCAD headless running 'modules freecad' crashes console

Postby chrisb » Fri Nov 01, 2019 2:17 pm

No crash here.

OS: macOS High Sierra (10.13)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18589 (Git)
Build type: Release
Branch: master
Hash: 3500451a040989d00693eab85b2a7c13ce4dad67
Python version: 3.7.3
Qt version: 5.12.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Germany (en_DE)
User avatar
sgrogan
Posts: 5585
Joined: Wed Oct 22, 2014 5:02 pm

Re: [Bug] FreeCAD headless running 'modules freecad' crashes console

Postby sgrogan » Fri Nov 01, 2019 4:47 pm

No problem here:

OS: Windows 7 SP 1 (6.1)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18644 (Git)
Build type: Release
Branch: master
Hash: 481870be2b48ef95b59acf1440b069d42b6fad23
Python version: 3.7.3
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United States (en_US)

OS: Windows 7 SP 1 (6.1)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18644 (Git)
Build type: Release
Branch: master
Hash: 481870be2b48ef95b59acf1440b069d42b6fad23
Python version: 3.6.7
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United States (en_US)
wmayer
Site Admin
Posts: 15274
Joined: Thu Feb 19, 2009 10:32 am

Re: [Bug] FreeCAD headless running 'modules freecad' crashes console

Postby wmayer » Sat Nov 02, 2019 10:41 am

No problem here either.
User avatar
Kunda1
Posts: 6427
Joined: Thu Jan 05, 2017 9:03 pm

Re: [Bug] FreeCAD headless running 'modules freecad' crashes console

Postby Kunda1 » Sat Nov 02, 2019 1:21 pm

Thanks everyone. Has anyone tried to reproduce it on an AppImage ?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features