@Etresoft:Thank you very much for your hints. Theys were really helpful to understand the problem in details.
Answers are below for your questions:
1-Do you really want to do that?
Unfortunately, yes! Before I wasted several days to create my .app file via Pyinstaller, I was not aware of this sandboxing problem.
Therefore I want to research a couple of days more to solve the problem.
2-you are trying to Notarize with a Developer ID too?
Actually It works fine somehow :) you can see in 9.Verification Of Certificate and sandboxing. But you can just ignore step9.
When I was debugging my sandboxing problem, I saw that “spctl -a -t exec -vv test.app” command was throwing “rejected” error, therefore I thought that my problem could be relevant with this rejection. But apparently it is not :)
3-That GitHub link contains a reference to this person getting something close working
I guess my problem is a similar one which you mentioned in your second link.
During my researches, I found following description in Pyinstaller tutorial:
PyInstaller Tutorial Bootloader Section - https://developer.apple.com/forums/content/attachment/8a6e87b3-8f02-4822-a837-5c770c7a668e
So I had a look into my activity monitor(test.app without sandboxing, since sandboxed application crashes immediately), and I saw that they are 2 processes indeed:
activity monitor view - https://developer.apple.com/forums/content/attachment/241f3a9f-3238-4851-bbf3-2eb97d83b784
Process id 8049 is parent of 8048. Could it be that I have to (somehow) inherit from my application itself for code signing?(<key>com.apple.security.inherit</key>) Maybe a similar situation as it is mentioned in your second link? Now "“Sandbox: test(8409) deny(1) forbidden-sandbox-reinit” error makes also sense.
I tried to codesign my test.py with following inheritance entitlements:
entitlements - https://developer.apple.com/forums/content/attachment/d44da246-9429-41c4-af47-12309b30db6d
But unfortunately I got following crash report:
crash report - https://developer.apple.com/forums/content/attachment/40143588-850e-4b63-92e1-f78f807d58fb
Do you have any idea?
Thank you very much in advance