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.

Image upload through a weblink throws error while saving an Item

See original GitHub issue

Description of the issue

While creating a new Item with an image (uploaded via weblink ) gives an error.

Version bench - 4.1.0 frappe - v11
erpnext - v11 os - Ubuntu 18.04.3 LTS

Steps to reproduce the issue

  1. create a new Item
  2. upload an image for the item using weblink option
  3. try to save it.

Stacktrace / full error message

Traceback (most recent call last):
  File "/.../apps/frappe/frappe/app.py", line 61, in application
    response = frappe.handler.handle()
  File "/.../apps/frappe/frappe/handler.py", line 21, in handle
    data = execute_cmd(cmd)
  File "/.../apps/frappe/frappe/handler.py", line 56, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "/.../apps/frappe/frappe/__init__.py", line 1036, in call
    return fn(*args, **newargs)
  File "/.../apps/frappe/frappe/desk/form/save.py", line 22, in savedocs
    doc.save()
  File "/.../apps/frappe/frappe/model/document.py", line 260, in save
    return self._save(*args, **kwargs)
  File "/.../apps/frappe/frappe/model/document.py", line 296, in _save
    self.run_before_save_methods()
  File "/.../apps/frappe/frappe/model/document.py", line 876, in run_before_save_methods
    self.run_method("validate")
  File "/.../apps/frappe/frappe/model/document.py", line 772, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/.../apps/frappe/frappe/model/document.py", line 1048, in composer
    return composed(self, method, *args, **kwargs)
  File "/.../apps/frappe/frappe/model/document.py", line 1031, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/.../apps/frappe/frappe/model/document.py", line 766, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/.../apps/erpnext/erpnext/stock/doctype/item/item.py", line 120, in validate
    self.make_thumbnail()
  File "/.../apps/erpnext/erpnext/stock/doctype/item/item.py", line 273, in make_thumbnail
    file_doc.make_thumbnail()
  File "/.../apps/frappe/frappe/core/doctype/file/file.py", line 201, in make_thumbnail
    image, filename, extn = get_web_image(self.file_url)
  File "/.../apps/frappe/frappe/core/doctype/file/file.py", line 409, in get_web_image
    image = Image.open(StringIO(frappe.safe_decode(r.content)))
TypeError: initial_value must be str or None, not bytes

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
netchampfariscommented, Nov 19, 2019

@vamagithub

upload-image-to-item

Tested on Version 11 on Python 3

0reactions
vamagithubcommented, Nov 3, 2019

itemDT

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix the HTTP Image Upload Error in WordPress
First, you should wait a few minutes and then try uploading your image file again. This error is sometimes caused by unusual traffic...
Read more >
Image Upload Error - SharePoint - Microsoft Tech Community
I found the issue was caused by NOT having 'Edit' access to the 'Site Assets' library. If you create a new 'Page' then...
Read more >
Error saving Item in cakephp when I upload an image within ...
it will allow the image to properly upload but will not save the product and when I use this code: <?php echo $this->Form-> ......
Read more >
How to Fix the WordPress HTTP Error (Uploading Image to ...
The WordPress HTTP error occurs when something goes wrong while attempting to upload images or videos using the built-in media library tool.
Read more >
Why can't I upload an image to my site? - Thinkific Help Center
Go to http://www.refreshyourcache.com/en/home/ and refresh your cache. Sometimes browser caching causes problems with file uploads. After clearing your browser ...
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