Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Preferences window fails to open #224

Closed
skovic opened this issue Nov 21, 2021 · 2 comments
Closed

[BUG] Preferences window fails to open #224

skovic opened this issue Nov 21, 2021 · 2 comments

Comments

@skovic
Copy link

skovic commented Nov 21, 2021

After clicking on Files->Preferences, the Preferences window fails to open, and the following error appears in the .sharppy/sharppy-out.txt file:

TypeError: only integer scalar arrays can be converted to a scalar index
Traceback (most recent call last):
  File "full_gui.py", line 1045, in preferencesbox
  File "sharppy\viz\preferences.py", line 344, in __init__
  File "sharppy\viz\preferences.py", line 378, in __initUI
  File "sharppy\viz\preferences.py", line 407, in _createReadoutWidget
OverflowError

This problem occurs while running the latest code from the master branch. I ran into this problem using a Windows binary (in Windows 10) that I built and also by running SHARPpy.py in a Linux environment. In both environments, I am using miniconda with the latest conda packages installed. The versions of the packages of interest are:

numpy 1.21.4
qt 5.12.9
qtpy 1.11.2

Root Cause:
Only an argument for the condition parameter is being provided when where() is called. As a result, per the numpy docs, this function call is actually shorthand for np.asarray(condition).nonzero(). Therefore, a tuple of arrays is actually being returned with one array per dimension, containing the indices of non-zero elements. For this reason, accessing the first element of each tuple actually yields an array of indices. This array (ndarray) of indices is then passed to setCurrentIndex() which is expecting an integer to be passed, resulting in the observed error.

@c0r3dump3d
Copy link

Hi, I have the same issue in sharppy 1.4.0 conda installation (conda 4.12.0), in a Linux Manjaro:

TypeError: only integer scalar arrays can be converted to a scalar index
Traceback (most recent call last):
  File "/home/andrew/anaconda3/envs/sharppy-env/lib/python3.9/site-packages/runsharp/full_gui.py", line 1045, in preferencesbox
    pref_dialog = PrefDialog(self.config, parent=self)
  File "/home/andrew/anaconda3/envs/sharppy-env/lib/python3.9/site-packages/sharppy/viz/preferences.py", line 344, in __init__
    self.__initUI()
  File "/home/andrew/anaconda3/envs/sharppy-env/lib/python3.9/site-packages/sharppy/viz/preferences.py", line 378, in __initUI
    readout_widget = self._createReadoutWidget()
  File "/home/andrew/anaconda3/envs/sharppy-env/lib/python3.9/site-packages/sharppy/viz/preferences.py", line 407, in _createReadoutWidget
    self.combo1.setCurrentIndex(idx1)
OverflowError

@Jeff-Szkodzinski
Copy link
Collaborator

The fix for this has been merged into the 'main' branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants