stuffmatic / fSpy-Blender

Official fSpy importer for Blender
https://fspy.io
GNU General Public License v3.0
1.22k stars 123 forks source link

Fspy not loading image when importing .fspy #15

Open Mamba-Grant opened 5 years ago

Mamba-Grant commented 5 years ago

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

Screenshot_1

image

fandongminghitmt commented 5 years ago

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

Cornbrother commented 4 years ago

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

stuffmatic commented 4 years ago

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.

Cornbrother commented 4 years ago

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.

solandshadow commented 4 years ago

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.

yadomi commented 3 years ago

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

Reubencfernandes commented 2 years ago

image im still getting this error im on blender 3.1

scollinselliott commented 2 years ago

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

Tumppa commented 1 year ago

Yes, running Blender as administration helped me too.