AppliedMechanics-EAFIT / SolidsPy

2D-Finite Element Analysis with Python
MIT License
258 stars 75 forks source link

Exception running example #3

Open kewp opened 7 years ago

kewp commented 7 years ago

I'm getting the following exception trying to run one of the examples using the script given in README.md.

import matplotlib.pyplot as plt  # load matplotlib
from solidspy import solids_GUI  # import our package
solids_GUI()  # run the Finite Element Analysis
plt.show()    # plot contours

Karls-Mac-mini:square-4_elements karl$ python test.py 2017-09-20 20:09:04.489 Python[6413:174880] -[NSApplication _setup:]: unrecognized selector sent to instance 0x10422ce40 2017-09-20 20:09:04.491 Python[6413:174880] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x10422ce40' First throw call stack: ( 0 CoreFoundation 0x00007fffc09a357b exceptionPreprocess + 171 1 libobjc.A.dylib 0x00007fffd5c041da objc_exception_throw + 48 2 CoreFoundation 0x00007fffc0a23f14 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132 3 CoreFoundation 0x00007fffc0916c93 __forwarding + 1059 4 CoreFoundation 0x00007fffc09167e8 _CF_forwarding_prep_0 + 120 5 Tk 0x0000000107acec02 TkpInit + 471 6 Tk 0x0000000107a4a2a9 Tk_Init + 1794 7 _tkinter.so 0x0000000106f42bfd Tcl_AppInit + 77 8 _tkinter.so 0x0000000106f41336 Tkinter_Create + 966 9 Python 0x00000001000c2f7d PyEval_EvalFrameEx + 21485 10 Python 0x00000001000c4f93 PyEval_EvalCodeEx + 2115 11 Python 0x000000010003e990 function_call + 176 12 Python 0x000000010000cde2 PyObject_Call + 98 13 Python 0x000000010001f43d instancemethod_call + 365 14 Python 0x000000010000cde2 PyObject_Call + 98 15 Python 0x00000001000bc8c7 PyEval_CallObjectWithKeywords + 87 16 Python 0x000000010002272e PyInstance_New + 126 17 Python 0x000000010000cde2 PyObject_Call + 98 18 Python 0x00000001000c0c10 PyEval_EvalFrameEx + 12416 19 Python 0x00000001000c4f93 PyEval_EvalCodeEx + 2115 20 Python 0x00000001000c33c0 PyEval_EvalFrameEx + 22576 21 Python 0x00000001000c4f93 PyEval_EvalCodeEx + 2115 22 Python 0x00000001000c33c0 PyEval_EvalFrameEx + 22576 23 Python 0x00000001000c4f93 PyEval_EvalCodeEx + 2115 24 Python 0x00000001000c33c0 PyEval_EvalFrameEx + 22576 25 Python 0x00000001000c4f93 PyEval_EvalCodeEx + 2115 26 Python 0x00000001000c50b6 PyEval_EvalCode + 54 27 Python 0x00000001000e993e PyRun_FileExFlags + 174 28 Python 0x00000001000e9bda PyRun_SimpleFileExFlags + 458 29 Python 0x0000000100100bfd Py_Main + 3101 30 Python 0x0000000100000f14 Python + 3860 ) libc++abi.dylib: terminating with uncaught exception of type NSException Abort trap: 6 Karls-Mac-mini:square-4_elements karl$

kewp commented 7 years ago

Oh I should mention I'm running on a Mac

nicoguaro commented 7 years ago

@kewp, we have seen the same error when trying to run SolidsPy from a terminal in Mac. I think that we should add that to the documentation, though.

If you are using Anaconda in Mac, I suggest that you run it through an Anaconda IPython console or Spyder.

cosmoscalibur commented 6 years ago

Some suggestion for fix can be found in:
About backend
Backend requiered is TkAgg and this is necessary to be set before import pyplot (best with rcParams).

About dependencies
libpng and freetype are required to be installed.