specklesystems / speckle-blender

https://speckle.systems/tag/blender/
Apache License 2.0
52 stars 9 forks source link

user information not being retreived from local configuration in Linux #165

Closed cristobaltapia closed 1 year ago

cristobaltapia commented 1 year ago

Hi, thanks for this plugin for speckle. I am trying to use this under Linux. I read the instructions posted here but I am getting the following error:

Python: Traceback (most recent call last):
  File "/home/tapiac/.config/blender/3.5/scripts/addons/bpy_speckle/operators/users.py", line 82, in execute
    speckle.active_user = str(active_user_index)
TypeError: bpy_struct: item.attr = val: enum "0" not found in ()

Expected vs. Actual Behavior

The users shuold be shown in the GUI, however, an error is raised.

Reproduction Steps & System Config (win, osx, web, etc.)

The plugin is installed under ~/.confg/blender/3.5/scripts/addons/bpy_speckle

I have manually added the configuration file under ~/.local/share/Speckle/Accounts and symlinked Speckle/ to ~/.config/blender/data/Speckle.

❯ ls -lh .config/blender/data 
total 0
lrwxrwxrwx 1 tapiac tapiac 33 Mai 30 11:36 Speckle -> /home/tapiac/.local/share/Speckle

In the folder Accounts I have placed a json file accoriding to the instructions from here.

Running the following commands in the REPL of Blender returns no account:

>>> import bpy_speckle as speckle
>>> speckle.users.get_local_accounts()
[]
gjedlicska commented 1 year ago

Hey @cristobaltapia sorry for being late on this.

Based on your report, you are using blender in a snap package. That is the reason why this is breaking for your. It is also the reason why we do not officially support linux as a target platform for Speckle. The application sandboxing mechanism for snap packages is set up in a way, that snap based apps have a different way of accessing the hosts file system. This adds extra security, properly sandboxes apps etc. What this boils down to in this case, is that Blender as a snap stores its config files in a different location to what you are using.

I'm not a daily snap user myself, but based on this it should be somewhere in ~/snaps/blender/....

I'm going to close this ticket, since we do not officially support this, but i'd be happy to continue this conversation on our forum https://speckle.community/

cristobaltapia commented 1 year ago

Hi @JR-Morgan, thanks for your reply. I just gave this another try and found the solution. The problem is not with the location of the configuration files for Blender. The snap package is actually using the config folder under ~/.config/blender. So that is good. The problem was the location of the Accounts folder. I thought that it had to be placed under ~/.config/blender/data/Speckle/ but it had to be under ~/.config/Speckle/. Does that make sense? Anyways, it works now, so I thought to post this here for future reference.

gjedlicska commented 1 year ago

Hey @cristobaltapia,

thanks for the test. It does makes sense. Speckle uses a centralized config folder under XDG_CONFIG_HOME which in most cases is ~/.config/Speckle/.

Turns out the blender snap is using classic confinement to allow full access to the host os file system ( if i remember snap terms correctly ). Another variation case in behavior under linux. ( Hence the lack of official support from us for now ) I'm glad it works for you. Do stop by our forum for a bit of show and tell, we're always curious what ppl are doing with Speckle especially if its pushing the boundaries of our mainstream workflows.