Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fspy not loading image when importing .fspy #15

Open
Mamba-Grant opened this issue Aug 10, 2019 · 9 comments · May be fixed by #51
Open

Fspy not loading image when importing .fspy #15

Mamba-Grant opened this issue Aug 10, 2019 · 9 comments · May be fixed by #51

Comments

@Mamba-Grant
Copy link

Mamba-Grant commented Aug 10, 2019

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

Screenshot_1

image

@fandongminghitmt
Copy link

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
Copy link

Cornbrother commented Apr 24, 2020

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
Copy link
Owner

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
Copy link

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
Copy link

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
Copy link

yadomi commented Oct 12, 2021

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

tmp_dir = bpy.app.tempdir
tmp_filename = "fspy-temp-image-" + uuid.uuid4().hex
tmp_path = os.path.join(tmp_dir, tmp_filename)
tmp_file = open(tmp_path, 'wb')
tmp_file.write(project.image_data)

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 #51 if you feel like it

@yadomi yadomi linked a pull request Oct 12, 2021 that will close this issue
@Reubencfernandes
Copy link

image
im still getting this error
im on blender 3.1

@scollinselliott
Copy link

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
Copy link

Tumppa commented Dec 22, 2022

Yes, running Blender as administration helped me too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants