libAtoms / abcd

1 stars 4 forks source link

Problem with `-` in labels #56

Closed eszter137 closed 4 years ago

eszter137 commented 4 years ago

When uploading the database, the label mp2-ttm4fmod_2b got accepted but the query won't work with it:


$ abcd summary -q "mp2-ttm4fmod_2b"
Illegal character '-'
Total number of configurations: 0
Illegal character '-'
Illegal character '-'
Illegal character '-'```
eszter137 commented 4 years ago

It seems to be impossible to delete this key:


$ abcd delete-key -q E_MP2_MBpol_3b mp2-ttm4fmod_3b
Illegal character '-'
Traceback (most recent call last):
  File "/Users/es732/anaconda3/bin/abcd", line 10, in <module>
    sys.exit(main())
  File "/Users/es732/anaconda3/lib/python3.7/site-packages/abcd/frontends/cli/parser.py", line 101, in main
    return callback_func(**kwargs)
  File "/Users/es732/anaconda3/lib/python3.7/site-packages/abcd/frontends/cli/decorators.py", line 64, in wrapper
    func(*args, **kwargs)
  File "/Users/es732/anaconda3/lib/python3.7/site-packages/abcd/frontends/cli/decorators.py", line 32, in wrapper
    func(*args, config=config, **kwargs)
  File "/Users/es732/anaconda3/lib/python3.7/site-packages/abcd/frontends/cli/decorators.py", line 52, in wrapper
    func(*args, db=db, query=q, **kwargs)
  File "/Users/es732/anaconda3/lib/python3.7/site-packages/abcd/frontends/cli/commands.py", line 231, in key_delete
    print('Please use --yes for deleting keys from {} configurations'.format(db.count(query=query)))
  File "/Users/es732/anaconda3/lib/python3.7/site-packages/abcd/backends/atoms_mongoengine.py", line 477, in count
    return AtomsModel.objects.query(query).count()
  File "/Users/es732/anaconda3/lib/python3.7/site-packages/mongoengine/queryset/queryset.py", line 133, in count
    return super(QuerySet, self).count(with_limit_and_skip)
  File "/Users/es732/anaconda3/lib/python3.7/site-packages/mongoengine/queryset/base.py", line 398, in count
    count = self._cursor.count(with_limit_and_skip=with_limit_and_skip)
  File "/Users/es732/anaconda3/lib/python3.7/site-packages/pymongo/cursor.py", line 784, in count
    cmd, self.__collation, session=self.__session)
  File "/Users/es732/anaconda3/lib/python3.7/site-packages/pymongo/collection.py", line 1583, in _count
    session=session)
  File "/Users/es732/anaconda3/lib/python3.7/site-packages/pymongo/collection.py", line 252, in _command
    user_fields=user_fields)
  File "/Users/es732/anaconda3/lib/python3.7/site-packages/pymongo/pool.py", line 584, in command
    user_fields=user_fields)
  File "/Users/es732/anaconda3/lib/python3.7/site-packages/pymongo/network.py", line 158, in command
    parse_write_concern_error=parse_write_concern_error)
  File "/Users/es732/anaconda3/lib/python3.7/site-packages/pymongo/helpers.py", line 155, in _check_command_response
    raise OperationFailure(msg % errmsg, code, response)
pymongo.errors.OperationFailure: $or/$and/$nor entries need to be full objects```
gabor1 commented 4 years ago

same as issue #60