tplmap icon indicating copy to clipboard operation
tplmap copied to clipboard

module 'collections' has no attribute 'Mapping'

Open freedom1b2830 opened this issue 2 years ago • 8 comments

any pages

error msg:

Testing if GET parameter 'id' is injectable
Exiting: module 'collections' has no attribute 'Mapping'

versions: Tplmap 0.5 616b0e5 #!/usr/bin/env python ->Python 3.10.4 (main, Mar 23 2022, 23:05:40) [GCC 11.2.0] on linux

os distr: ArchLinux

freedom1b2830 avatar May 27 '22 16:05 freedom1b2830

Hello,

The error comes from this import in core/plugin.py :

import collections

In fact, since python3.3, this method to import Mapping is deprecated.

It should be :

from collections.abc import Mapping

I will make a pull request to fix this but you can fix this issue 😄

Br,

0xSysr3ll

0xSysR3ll avatar Jul 25 '22 16:07 0xSysR3ll

After your defined change it says:

Tplmap 0.5 Automatic Server-Side Template Injection Detection and Exploitation Tool

Testing if GET parameter 'name' is injectable Exiting: name 'collections' is not defined

ndsecc avatar Nov 26 '22 17:11 ndsecc

For python 3.10 it's: from collections import Mapping

ndsecc avatar Nov 26 '22 18:11 ndsecc

For those who is little confused like me, you should not just add from collections import Mapping, but replace collections.Mapping with Mapping at lines 21 and 22 in the core/plugin.py

man3kin3ko avatar Nov 30 '22 10:11 man3kin3ko

Hello,

The error comes from this import in core/plugin.py :

import collections

In fact, since python3.3, this method to import Mapping is deprecated.

It should be :

from collections.abc import Mapping

I will make a pull request to fix this but you can fix this issue 😄

Br,

0xSysr3ll

After changing the collection library to: from collections import Mapping there is another issue is arising. ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

Help me;

abdulx01 avatar Dec 15 '22 16:12 abdulx01

Hello, The error comes from this import in core/plugin.py :

import collections

In fact, since python3.3, this method to import Mapping is deprecated. It should be :

from collections.abc import Mapping

I will make a pull request to fix this but you can fix this issue 😄 Br, 0xSysr3ll

After changing the collection library to: from collections import Mapping there is another issue is arising. ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

Help me;

You probably need to change it from from collections import Mapping to from collections.abc import Mapping

inzel avatar Sep 27 '23 14:09 inzel

I just encountered this issue and resolved it by replacing the import with import collections.abc and also replacing the references in lines 21 and 22 in core/plugin.py with collections.abc.Mapping instead of collections.Mapping.

r-erd avatar Nov 28 '23 18:11 r-erd

hello the solution is go to core/plugin.py and change "import collections" to "import collections.abc" then down in line 21 22 change collections.abc.Mapping instead of collections.Mapping.

hhhhhhhds6 avatar Dec 02 '23 13:12 hhhhhhhds6