question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: Mail contrib: Negative indexing is not supported error

See original GitHub issue

Brief summary of issue:

After having implemented the mail.py contrib module, I started to fiddle around with it and saw that after inputting @mail 1 (to check mail with id 1) it would be executed as it should be. However, when you try a negative number, like @mail 0, it would give the Assertion Error: Negative indexing is not supported, which is generated from the django package.

Steps to reproduce the issue:

  1. Implement the mail.py module from evennia/contrib
  2. Type in ‘@mail 0’ or ‘@mail -42’ for example

Error output

Traceback (most recent call last):
  File "c:\mud\evennia\evennia\commands\cmdhandler.py", line 509, in _run_command
    ret = yield cmd.func()
  File ".\commands\mail.py", line 214, in func
    message = self.get_all_mail()[int(self.lhs) - 1]
  File "c:\mud\pyenv\Lib\site-packages\django\db\models\query.py", line 277, in __getitem__
    "Negative indexing is not supported."
AssertionError: Negative indexing is not supported.

Extra information, such as Evennia revision/repo/branch, operating system and ideas for how to solve:

Happened on rev ae2c2be8, but doesn’t matter which revision as long as the mail.py contrib module is implemented in the system.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Griatchcommented, Apr 20, 2017

This is because it is trying to index in a queryset, which does not support negative indexing. This should be handled as part of the input verification. Pinging @grungies1138 in case he wants to peek at it.

0reactions
Griatchcommented, Sep 30, 2017

I fixed the contrib with more elaborate index error checking. So this should not happen any more. Closing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

django - AssertionError: Negative indexing is not supported
This will happen mostly when you are trying some indexing related operation on an empty list. Try this instead:
Read more >
Negative indexing is not supported. - Google Groups
It's an issue with django-mptt breaking their API in 0.5.0 and 0.5.2 (0.5.1 works). children should NOT be a queryset (it wasn't pre-0.5.0)...
Read more >
#13089 (Support Negative Indexing on QuerySets) – Django
In short: querysets are not == lists. The problem with saying the python negative indexing idiom should be supported is that negative indexing...
Read more >
Considerations in adopting RHEL 8 Red Hat Enterprise Linux 8
Negative effects of the default logging setup on performance ... The e1000 network driver is not supported in RHEL 8; 11.1.3.4. ... Click...
Read more >
4. Release Notes — Buildbot 2.3.1 documentation
Notably, Internet Explorer 11 is not supported in this release. ... Fix encoding issues with Forcescheduler parameters error management code.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found