Blender Cloud add-on error uploading screenshot #49080

Closed
opened 2016-08-12 22:07:11 +02:00 by Antonio Vazquez · 12 comments

Blender 2.77a and 277.3
Windows 10 64 bits
Blender Id: 1.2.0
Blender Cloud: 1.4.2

Upload a render works perfect but if select upload screenshot, I get an error with the following log:

imb_savepng: Cannot open file for writing: 'C:\Users\Antonio\AppData\Local\Temp\tmp2onpz2c_\Screenshot-2016-08-12-22:05:11.png'
C:\Users\Antonio\AppData\Local\Temp\tmp2onpz2c_\Screenshot-2016-08-12-22:05:11.png: Invalid argument
Error: Could not write image: Invalid argument
Unexpected exception caught.
Traceback (most recent call last):

File "C:\Users\Antonio\AppData\Roaming\Blender Foundation\Blender\2.77\scripts\addons\blender_cloud\image_sharing.py", line 167, in async_execute
  await self.share_image(context)
File "C:\Users\Antonio\AppData\Roaming\Blender Foundation\Blender\2.77\scripts\addons\blender_cloud\image_sharing.py", line 181, in share_image
  node = await self.upload_screenshot(context)
File "C:\Users\Antonio\AppData\Roaming\Blender Foundation\Blender\2.77\scripts\addons\blender_cloud\image_sharing.py", line 299, in upload_screenshot
  full=self.screenshot_full)
File "C:\Users\Antonio\Downloads\blender-2.77.0-git.1fe9d67-AMD64\2.77\scripts\modules\bpy\ops.py", line 189, in __call__
  ret = op_call(self.idname_py(), None, kw)

RuntimeError: Error: Could not write image: Invalid argument

Info: Uploading screenshot 'Screenshot-2016-08-12-22:05:11.png'
Error: Unexpected error <class 'RuntimeError'>: Error: Could not write image: Invalid argument

Blender 2.77a and 277.3 Windows 10 64 bits Blender Id: 1.2.0 Blender Cloud: 1.4.2 Upload a render works perfect but if select upload screenshot, I get an error with the following log: imb_savepng: Cannot open file for writing: 'C:\Users\Antonio\AppData\Local\Temp\tmp2onpz2c_\Screenshot-2016-08-12-22:05:11.png' C:\Users\Antonio\AppData\Local\Temp\tmp2onpz2c_\Screenshot-2016-08-12-22:05:11.png: Invalid argument Error: Could not write image: Invalid argument Unexpected exception caught. Traceback (most recent call last): ``` File "C:\Users\Antonio\AppData\Roaming\Blender Foundation\Blender\2.77\scripts\addons\blender_cloud\image_sharing.py", line 167, in async_execute await self.share_image(context) File "C:\Users\Antonio\AppData\Roaming\Blender Foundation\Blender\2.77\scripts\addons\blender_cloud\image_sharing.py", line 181, in share_image node = await self.upload_screenshot(context) File "C:\Users\Antonio\AppData\Roaming\Blender Foundation\Blender\2.77\scripts\addons\blender_cloud\image_sharing.py", line 299, in upload_screenshot full=self.screenshot_full) File "C:\Users\Antonio\Downloads\blender-2.77.0-git.1fe9d67-AMD64\2.77\scripts\modules\bpy\ops.py", line 189, in __call__ ret = op_call(self.idname_py(), None, kw) ``` RuntimeError: Error: Could not write image: Invalid argument Info: Uploading screenshot 'Screenshot-2016-08-12-22:05:11.png' Error: Unexpected error <class 'RuntimeError'>: Error: Could not write image: Invalid argument

Changed status to: 'Open'

Changed status to: 'Open'

Added subscriber: @antoniov

Added subscriber: @antoniov

I have been investigating the error and the error is image_sharing.py line 294:

with tempfile.TemporaryDirectory() as tmpdir:
          filepath = os.path.join(tmpdir, self.name)
          self.log.debug('Saving screenshot to %s', filepath)
        # ERROR here
          bpy.ops.screen.screenshot(filepath=filepath,
                                    show_multiview=self.screenshot_show_multiview,
                                    use_multiview=self.screenshot_use_multiview,
                                    full=self.screenshot_full)
          return await self.upload_file(filepath)
I have been investigating the error and the error is image_sharing.py line 294: ``` with tempfile.TemporaryDirectory() as tmpdir: filepath = os.path.join(tmpdir, self.name) self.log.debug('Saving screenshot to %s', filepath) ``` # ERROR here ``` bpy.ops.screen.screenshot(filepath=filepath, show_multiview=self.screenshot_show_multiview, use_multiview=self.screenshot_use_multiview, full=self.screenshot_full) ``` ``` return await self.upload_file(filepath) ```

I have found the reason:

The name of the file contains : and this is incorrect:

Name with : in time (ERROR):

bpy.ops.screen.screenshot(filepath="C:/Users/Antonio/AppData/Local/Temp/Screenshot-2016-08-12-22:34:36.png",show_multiview=False,use_multiview=False,full=True)
Error: Could not write image: Invalid argument

Now, with name changed (OK):

bpy.ops.screen.screenshot(filepath="C:/Users/Antonio/AppData/Local/Temp/Screenshot-2016-08-12-22-34-36.png",show_multiview=False,use_multiview=False,full=True)
{'FINISHED'}

I have replaced the line 288 in my local copy and works:

self.name = datetime.datetime.now().strftime('Screenshot-%Y-%m-%d-%H_%M_%S.png')

I could fix it in addons repo, but I want you confirm before.

I have found the reason: The name of the file contains : and this is incorrect: Name with : in time (ERROR): bpy.ops.screen.screenshot(filepath="C:/Users/Antonio/AppData/Local/Temp/Screenshot-2016-08-12-22:34:36.png",show_multiview=False,use_multiview=False,full=True) Error: Could not write image: Invalid argument Now, with name changed (OK): bpy.ops.screen.screenshot(filepath="C:/Users/Antonio/AppData/Local/Temp/Screenshot-2016-08-12-22-34-36.png",show_multiview=False,use_multiview=False,full=True) {'FINISHED'} I have replaced the line 288 in my local copy and works: self.name = datetime.datetime.now().strftime('Screenshot-%Y-%m-%d-%H_%M_%S.png') I could fix it in addons repo, but I want you confirm before.

Added subscribers: @dr.sybren, @fsiddi

Added subscribers: @dr.sybren, @fsiddi

Thanks for investigating and proposing this fix!
I'm fine with the change. Maybe use the - sign in all the filename as separator.

Thanks for investigating and proposing this fix! I'm fine with the change. Maybe use the `-` sign in all the filename as separator.

@fsiddi I haven't right to edit cloud add-on, so I cannot fix it myself.

@fsiddi I haven't right to edit cloud add-on, so I cannot fix it myself.
Sybren A. Stüvel self-assigned this 2016-08-15 11:51:06 +02:00

Personally I'd rather not have separators then, between the hours, minutes and seconds. Otherwise it becomes a dashfest.

I'll implement this when I'm back from holiday next week.

Personally I'd rather not have separators then, between the hours, minutes and seconds. Otherwise it becomes a dashfest. I'll implement this when I'm back from holiday next week.

This issue was referenced by archive/blender-cloud-addon@2388f800dc

This issue was referenced by archive/blender-cloud-addon@2388f800dc343f99805ec9dbe7301f737745dec9

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Changed status from 'Resolved' to: 'Archived'

Changed status from 'Resolved' to: 'Archived'

Version 1.4.3 fixes this, and can be downloaded from https://cloud.blender.org/r/downloads/blender_cloud-latest-bundle.zip

Version 1.4.3 fixes this, and can be downloaded from https://cloud.blender.org/r/downloads/blender_cloud-latest-bundle.zip
Sign in to join this conversation.
4 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: archive/pillar#49080
No description provided.