fSpy-Blender icon indicating copy to clipboard operation
fSpy-Blender copied to clipboard

Fspy not loading image when importing .fspy

Open Mamba-Grant opened this issue 5 years ago • 9 comments

When importing a .fspy, the camera is adjusted, but no image is loaded.

Screenshot_1

image

Mamba-Grant avatar Aug 10 '19 15:08 Mamba-Grant

Traceback (most recent call last): File "C:\Users\范导\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\fspy_blender\addon.py", line 65, in execute self.import_background_image File "C:\Users\范导\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\fspy_blender\addon.py", line 259, in import_fpsy_project self.set_up_3d_area(project, camera, update_existing_camera, set_background_image) File "C:\Users\范导\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\fspy_blender\addon.py", line 187, in set_up_3d_area img = bpy.data.images.load(tmp_path) RuntimeError: Error: Cannot read '/tmp/blender_a01636\fspy-temp-image-203fd4fcd96c4f9ab24fc6c4c4a3f13e': No such file or directory

location: :-1

fandongminghitmt avatar Aug 15 '19 05:08 fandongminghitmt

I can confirm this issue still persists into 2020:

Traceback (most recent call last): File "C:\Users\Corn brother\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\fspy_blender\addon.py", line 65, in execute self.import_background_image File "C:\Users\Corn brother\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\fspy_blender\addon.py", line 263, in import_fpsy_project self.set_up_3d_area(project, camera, update_existing_camera, set_background_image) File "C:\Users\Corn brother\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\fspy_blender\addon.py", line 186, in set_up_3d_area tmp_file = open(tmp_path, 'wb') FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\CORNBR~1\AppData\Local\Temp\blender_a01408\fspy-temp-image-b92f8a6e38d14782a9a3bcdf987f0fde'

location: :-1

Guildnavigator.zip

Cornbrother avatar Apr 24 '20 10:04 Cornbrother

The importer writes the image to a temporary file before loading it and it looks like the importer is not allowed to write to that file... If anyone knows what's going on here, I would love to get some hints.

stuffmatic avatar Apr 24 '20 13:04 stuffmatic

I've been wracking my brain trying to think of variables that could be affecting it but I have no idea. I can confirm that it's failing to write to/find the named folder in the tmp directory but I couldn't tell you why, It doesn't seem to be permissions based as other applications and add-ons are able to freely write there. If there is anything I can do to help you though I'm happy to help.

Cornbrother avatar Apr 26 '20 08:04 Cornbrother

Hey Guys I dont know if this got resolved or not but I was having a similar issue where it would not load in the image with the file. The image file I was using was a GIF and I just took it and converted it into a JPEG with Illustrator. I put it back into fspy and saved that file. Everything worked fine and dandy once I loaded it into Blender. This is literally my first day actually on Github so idea how to analyze files or anything like that yet. But I figured I might as well throw it out there just as a thread to follow. Sorry I cant be any more help.

solandshadow avatar Aug 14 '20 21:08 solandshadow

I had the same issue with the latest release of fSpy and Blender. This seems to come from this:

https://github.com/stuffmatic/fSpy-Blender/blob/6c860b35397ec5c14b51c86445e2f2907de12403/fspy_blender/addon.py#L183-L187

bpy.app.tempdir return a path to a directory that does not exist so open() is not happy

On windows, the path is something like this C:\\Users\\<user>\\AppData\\Local\\Temp\\blender_a04196\\fspy-temp-image-6b224c32b1af41f88722165dea62e191 but blender_a04196 does not exist.

I'm not sure why the blender session tmp directory does not exist, since it is usually created when blender starts but not all the time

I've created a PR to fix that here https://github.com/stuffmatic/fSpy-Blender/pull/51 if you feel like it

yadomi avatar Oct 12 '21 18:10 yadomi

image im still getting this error im on blender 3.1

Reubencfernandes avatar Mar 26 '22 17:03 Reubencfernandes

Had this issue on Windows 10 with writing to the temp directory and the cause was directory permissions (running Blender as administrator resolved it).

scollinselliott avatar May 18 '22 20:05 scollinselliott

Yes, running Blender as administration helped me too.

Tumppa avatar Dec 22 '22 14:12 Tumppa