0

I am trying to install and use awesome avatar for my user

from awesome_avatar.fields import AvatarField
class MyUser(models.Model):
    image = AvatarField(upload_to='users/%Y/%m/%d/', width=100, height=100)

but when i trying to start my project i had an problem with module name "StringIo"

 from StringIO import StringIO
ModuleNotFoundError: No module named 'StringIO'

I tried to install it but it has not a proper version of it Here full text of error

 Exception in thread django-main-thread:
Traceback (most recent call last):
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\awesome_avatar\fields.py", line 8, in <module>
    from cStringIO import StringIO
ModuleNotFoundError: No module named 'cStringIO'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\commands\runserver.py", line 110, in inner_run      
    autoreload.raise_last_exception()
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\utils\autoreload.py", line 87, in raise_last_exception
    raise _exception[1]
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\__init__.py", line 375, in execute
    autoreload.check_errors(django.setup)()
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\apps\registry.py", line 114, in populate
    app_config.import_models()
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\apps\config.py", line 301, in import_models
    self.models_module = import_module(models_module_name)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "D:\work\Ubertrip\ubetrip\trips\models.py", line 5, in <module>
    from awesome_avatar.fields import AvatarField
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\awesome_avatar\fields.py", line 10, in <module>
    from StringIO import StringIO
ModuleNotFoundError: No module named 'StringIO'
D:\work\Ubertrip\ubetrip\ubetrip\settings.py changed, reloading.
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\awesome_avatar\fields.py", line 8, in <module>
    from cStringIO import StringIO
ModuleNotFoundError: No module named 'cStringIO'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\commands\runserver.py", line 110, in inner_run      
    autoreload.raise_last_exception()
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\utils\autoreload.py", line 87, in raise_last_exception
    raise _exception[1]
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\__init__.py", line 375, in execute
    autoreload.check_errors(django.setup)()
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\apps\registry.py", line 114, in populate
    app_config.import_models()
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\apps\config.py", line 301, in import_models
    self.models_module = import_module(models_module_name)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "D:\work\Ubertrip\ubetrip\trips\models.py", line 5, in <module>
    from awesome_avatar.fields import AvatarField
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\awesome_avatar\fields.py", line 10, in <module>
    from StringIO import StringIO
ModuleNotFoundError: No module named 'StringIO'

How can i fix it? Or maybe someone can advise me a better aplication for user profile avatar with cropping image?

Andreyka
  • 69
  • 6
  • check this answer https://stackoverflow.com/questions/48938978/no-module-named-stringio – hakim13or May 14 '21 at 12:42
  • @hakim13or i need just place impor IO in my module file? – Andreyka May 14 '21 at 12:49
  • I checked their GitHub repository, and I think this package is outdated (the last update is 7 years ago ) https://github.com/voronind/django-awesome-avatar/pull/21 – hakim13or May 14 '21 at 12:57
  • @hakim13or Oh, ok thanks, maybe you know other solutions for this purpouse? I need apllication to give users ability to crop images? Maybe even something on js? – Andreyka May 14 '21 at 12:59

1 Answers1

0

It's outdated, so there is no fix for this, except lower version of python

Andreyka
  • 69
  • 6