Closed critcortex closed 7 years ago
@hussainazfar , do you also encounter this? I'm trying to work out whether it's an anaconda thing or an os thing, or a qt thing ...
Bah ... it looks like it's a Qt thing. Kedz, you detail which Python version and Qt version is on your system pls?
For me,
$ qmake --version
Using Qt version 5.6.0 in /Users/sjarvis/programs/anaconda2/lib
$ python --version
Python 2.7.12 :: Anaconda 4.2.0 (x86_64)
@critcortex: Ah. This seems familiar. Cliff struggled to get the GUI working on his end for the same reason. For info, I'm running with: AnaPython 2.7.13 | Anaconda 4.3.1 (64-bit) As well as: QMake version 3.0 | Using Qt version 5.6.2 in C:/ProgramData/Anaconda2/Library/lib But yes, whenever I use qtw.QFileDialog.getOpenFileName(), it returns a tuple like: (u'D:/Projects - Work/Optima/tb-ucl-analyses/belarus/Cascade Spreadsheets/cascade-belarus.xlsx', u'') This is why I extract the zeroth index to get cascade_path (et al.) On your system (and Cliff's) the return may be something different. Perhaps just a string? In Cliff's case, I assumed it was because he was trying to get the GUI working with PyQt4, but your output seems to suggest you're using PyQt5...
@critcortex: To extend that comment, I found this on the internets: "If you read the differences between PyQt4 and PyQt5, you will see that getOpenFileName is now the new name for getOpenFileNameAndFilter, which returns a tuple (filename, selected filter). Thus to get the filename, you need the first element of the tuple." I have thus made a commit with try/except clauses that should hopefully work for either v4 or v5. It continues to work on my system, but I'm happy for another system to test it too (although @cliffckerr will probably do that anyway as he's wedded to PyQt4). However, as a side note, your Python interpreter must not be registering PyQt5 somehow if you're crashing with that issue. It could be a linking issue or something odd with Cliff's importPyQt function on your end.
But yes, whenever I use qtw.QFileDialog.getOpenFileName(), it returns a tuple like: (u'D:/Projects - Work/Optima/tb-ucl-analyses/belarus/Cascade Spreadsheets/cascade-belarus.xlsx', u'') This is why I extract the zeroth index to get cascade_path (et al.) On your system (and Cliff's) the return may be something different. Perhaps just a string?
Aye, as per my edit to gui.py
in the above comment, it returns /
i.e. an empty path.
I'll try updating to match your Qt version and see where that gets me ...
This was fixed with Qt version wrangling
Unable to generate a new project via GUI - problem seems to be in the Qt choosing the cascade file location correctly.
Running from
redesign
branch on a Mac OSX (no anaconda)Steps to reproduce:
gui_south_africa.py
in corresponding folder intb-ucl-analyses
See screenshot to see resulting error message at the bottom of the pane:
Also, I went into
gui.py
to see what file was selected by the file chooser (thinking that it could be a file path problem).for line 142 in
createProject()
, I added a print statement, i.e.which gave the output of: