1

Using pythonnet to access some dlls from python and the dlls are not able to access the linux directories no matter what owner or permissions are set to. Just get an access denied message like this.

Access to the path '/tmp/work' is denied.

Seems like it should work. Anyone have a tip on this?

denfromufa
  • 5,610
  • 13
  • 81
  • 138
Dan Littlejohn
  • 1,329
  • 4
  • 16
  • 30
  • have you tried launching your python process with superuser (sudo) access? – denfromufa Jun 07 '18 at 05:27
  • just tried it and running with sudo still give the same access denied error – Dan Littlejohn Jun 09 '18 at 04:14
  • Are you able to reference and access these Mono dlls from scriptcs or any C# app in MonoDevelop/Rider/VSCODE? Maybe this is related: https://stackoverflow.com/q/20686389/2230844 – denfromufa Jun 09 '18 at 04:30
  • wow, that put me on the path to fix the problem. I was using the release build of the dlls and it just gives that vague permissions error and nothing else. I switched to the debug build and that gave me a proper exception that showed I was missing a reference. I added it and it worked! If you would like to answer this question I would be happy to mark it as answered. Thanks! – Dan Littlejohn Jun 09 '18 at 15:44
  • you can answer your own questions, my suggestions were not directly related to your fix – denfromufa Jun 11 '18 at 10:43

1 Answers1

1

In using the release build of the .Net dlls it was only giving the vague permission denied error message (checking the return .error variable). That was not the problem at all although I spend a lot of time trying to fix it. Per the tip from denfromufa I changed to use the debug build of the .Net dll and it throws a proper exception. I was missing a reference. So the lesson for me is it is better to use the debug build of .Net dlls if you run them with pythonnet.

Dan Littlejohn
  • 1,329
  • 4
  • 16
  • 30