SteveDoyle2 / pyNastran

A Python-based interface tool for Nastran's file formats
Other
384 stars 147 forks source link

Error in booting ver. 1.4.0 #761

Closed YoichiroUrita closed 6 months ago

YoichiroUrita commented 6 months ago

hi,

Error in my environment(windows10) on pyNastran ver.1.4.0

I am new to pyNasrtan and downloaded pyNastran March 1st AM(JST) from https://sourceforge.net/projects/pynastran/files/?source=navbar

So, it was just released new version.

Run pyNastranGUI.exe, then error message was displayed as below and stop running. (I tried ver.1.3.4 too. But it's 'no error' for my environment.)

File "gui.py",line 114,in File "gui.py",line 110, in cmd_line File "main_window.py", line 162 , in init File "gui_common.py", line 1529, in setup_gui File "gui_common.py",line 293, in set_tools File "gui_common.py",line 458, in get_recent_file_tools UnboundLocalError: cannot access local variable 'ifile' where it is not associated with a value [7668] Failed to execute script 'gui' due to unhandled exception!

After error occurred, I installed pyNastran by pip command as https://pynastran-git.readthedocs.io/en/1.4/installation/installation.html (python 3.10.8) And try to fix this problem.

Temporary fix (Enable to boot for my environment)

file:gui/gui_common.py add line 445 ifile=0

commented out line 562 to 566 #if NFILES_TO_SAVE: # filei = [f'file{ifile+1:d}' for ifile in range(NFILES_TO_SAVE)] # #print(f'filei={filei}') # menu_file.extend(filei) # menu_file.append('')

thanks.

SteveDoyle2 commented 6 months ago

Ooops! Not sure why it worked for other people testing it.

It should also work if you put this in the following folder pyNastranGUI.json r:

The fix is to just set ifile=-1

YoichiroUrita commented 6 months ago

Thank you Steve.

For report, I tried what you replied. It's good for me. 1)Fix way 1: put pyNastraGUI.json file The error is fixed after put the file to same as pyNastranGUI.exe.

2)Fix way 2:modify source code file:gui/gui_common.py add line 445 ifile=-1 (no need to comment out line 562 to 566)