maximeraafat/BlenderNeRF

FileNotFoundError

Closed this issue · 7 comments

I followed your instructions, but for some reason I'm not able to run the addon. This is the error I'm getting, running on latest python version 3.10.8.
Already gave Blender including the addon high rights. Same as for the destination folder.
image

Hi @Erik262, I'm sorry to hear that you are experiencing issues with the code.

I've tried to replicate your issue by running the SOF module with the release v2 version of the addon (I believe you've been using this one, let me know if I'm incorrect), but didn't run into any issues. Could you perhaps let me know the exact steps you've been taking, or at least send me a screenshot of the addon user interface panel with the options you've ticked and chosen?

On a side note, when saying that you gave Blender high rights, do you mean that you gave it the permission to write data on your disk?

Hi @maximeraafat, I fixed that problem by creating the folders by hand. Thats it. The only reason why it was not working. Very strange. I used the version in the release section.

Hi @Erik262 , this is a strange behaviour that shouldn't happen, since the addon takes care of creating all the respective folders. Are you sure that you gave all the necessary permissions to Blender?

A good way to check this would be to go to the Scripting top panel in Blender, and in the Python Console you can enter the following command (be sure to enter any valid existing path for the path variable):

import os
import json
data = {'testdata': 0}
path = '/Users/<yourname>/Downloads/'
foldername = 'testfolder'
folderpath = os.path.join(path, foldername)
os.makedirs(folderpath, exist_ok=True)
filepath = os.path.join(folderpath, 'test.json')
with open(filepath, 'w') as file:
    json.dump(data, file, indent=4)

This code will create a directory called testfolder with a test.json file, saved under path.
Let me know whether this works :)

@maximeraafat
I'm getting the same error message. I gave Blender full Access to all folders. Creating/Saving a project works in every folder.

image

Also... I asked a friend to try this addon on his machine (Windows), he is also getting the same error, and I'm on a mac machine.

Hi @Erik262, ok I see. From what you told me, it seems that creating the .json file itself is not an issue, but creating the directory is. Can you try to run the above code again, but by first creating the testfolder folder manually under the desired location? For the sake of completeness and being sure that this is the issue, can you also run the code below:

import os
import json
data = {'testdata': 0}
path = '/Users/<yourname>/Downloads/'
filepath = os.path.join(path, 'test.json')
with open(filepath, 'w') as file:
    json.dump(data, file, indent=4)

This should directly create a test.json file under path, without creating the intermediary folder. If both of these experiments work without issues, then the issue lies in os.makedirs(folderpath, exist_ok=True), which simply creates the folder if it does not exist yet. To see whether this issue is Blender related, simply open a python environment (for instance by running python3 in a terminal) and run the same code from my previous comment.

Hi @maximeraafat so it is definitely an issue with os.makedirs(folderpath, exist_ok=True) If the folder exists, the json file will be created. If not, the same error appears, as mentioned in my first post.
That's very strange if I run the same code in a separate python like you said, it works. But not from the Blender site.

Hi @Erik262, in this case the issue does not lie with the addon code, but with your computer's permissions with respect to Blender. Perhaps you could reset the permissions in your settings to grant Blender full access to your computer disk. Another suggestion would be to uninstall Blender and reinstall it from scratch, and grant all the access during the installation process.

I am to be honest unsure on the exact steps you should follow to solve this issue. You might want to verify whether you have administrative rights on your computer. Please feel free to share any progress on this topic in this GitHub issue!