Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • beat.editor beat.editor
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 11
    • Issues 11
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • beatbeat
  • beat.editorbeat.editor
  • Issues
  • #232
Closed
Open
Issue created Jun 19, 2019 by Zohreh MOSTAANI@zmostaaniDeveloper

An empty json file in the correct directory structure crashes the editor

At the moment it is assumed the prefix is completely valid. If a user adds an empty json file (using file manager or command line for example $ touch 1.json) in the correct directory format, if the editor is open it is shown on the list of the available asset, without any error or warning. But is you click on it the editor will close completely and there is a log error.

Traceback (most recent call last):
  File "/remote/idiap.svm/user.active/zmostaani/experiments/beat/beat.editor/beat/editor/widgets/assetwidget.py", line 358, in loadAsset
    self.__update_content()
  File "/remote/idiap.svm/user.active/zmostaani/experiments/beat/beat.editor/beat/editor/widgets/assetwidget.py", line 214, in __update_content
    editor.load_json(json.loads(json_data))
  File "/idiap/user/zmostaani/miniconda3/envs/beat2/lib/python3.6/site-packages/simplejson/__init__.py", line 518, in loads
    return _default_decoder.decode(s)
  File "/idiap/user/zmostaani/miniconda3/envs/beat2/lib/python3.6/site-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/idiap/user/zmostaani/miniconda3/envs/beat2/lib/python3.6/site-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Aborted

After the editor crashes you can run it again. It will run containing the mistaken json file. Now assume you know where the problem is and this time you learnt your lesson and you want to use editor to delete the asset. Go to the file in question. Right click on it and choose delete. Again the editor crashes and this is in the log info:

Traceback (most recent call last):
  File "/remote/idiap.svm/user.active/zmostaani/experiments/beat/beat.editor/beat/editor/widgets/assetwidget.py", line 321, in deleteAsset
    if self.current_asset.declaration_path == file_path:
AttributeError: 'NoneType' object has no attribute 'declaration_path'
Aborted

You can only remove it now is to use file manager or command line again.

It would be good to handle such instances more gracefully and more informative for the user since it is not easy from this log to understand where the problem is unless the user remembers exactly what they have done to cause this problem. It is not always the case :D

Also if we have multiple instance of editor open from terminal (see #228) and lose this information completely it would be even worse.

Edited Jun 19, 2019 by Zohreh MOSTAANI
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking