Skip to content

openscad crashes on mac when opening .py files #33

@ffavero

Description

@ffavero

Describe the bug

After installing OpenScad and having python3.12 functional and correctly installed in the system, openscad crash when open a python source file

To Reproduce
Steps to reproduce the behavior:

  1. Download OpenScad from https://pythonscad.org/
  2. install python via homebrew "brew install python@3.12"
  3. Open a .py file
  4. See error

Expected behavior
this fork of OpenScad should open .py files

Code reproducing the issue
If applicable, add trimmed down, self-contained code demonstrating the issue.

/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD     
qt.qpa.fonts: Populating font family aliases took 59 ms. Replace uses of missing font family "Open Sans" with one that exists to avoid this cost. 
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = '/Applications/OpenSCAD.app/Contents/MacOS/../libraries/python/:.'
  program name = 'python3'
  isolated = 0
  environment = 1
  user site = 1
  safe_path = 0
  import site = 1
  is in build tree = 0
  stdlib dir = '/usr/local/lib/python3.12'
  sys._base_executable = '/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD'
  sys.base_prefix = '/usr/local'
  sys.base_exec_prefix = '/usr/local'
  sys.platlibdir = 'lib'
  sys.executable = '/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD'
  sys.prefix = '/usr/local'
  sys.exec_prefix = '/usr/local'
  sys.path = [
    '/Applications/OpenSCAD.app/Contents/libraries/python',
    '/Users/ffra/src/my_thing',
    '/usr/local/lib/python312.zip',
    '/usr/local/lib/python3.12',
    '/usr/local/lib/python3.12/lib-dynload',
  ]
FALLBACK (log once): Fallback to SW vertex for line stipple
FALLBACK (log once): Fallback to SW vertex processing, m_disable_code: 2000
FALLBACK (log once): Fallback to SW vertex processing in drawCore, m_disable_code: 2000
Fatal Python error: PyImport_AppendInittab: PyImport_AppendInittab() may not be called after Py_Initialize()
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00000001ef40cf40 (most recent call first):
  <no Python frame>
zsh: abort      /Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD

Environment and Version info (please complete the following information):

Additional context

The issue seems that the python path needs to be in a specific location. I've tried to symlink the installed python in varous places to make it use the correct one, but it probably can't find it. It would be nice if we could specify a version of the python path to use in some setting panel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions