{"action":"created","issue":{"url":"https://api.github.com/repos/pyinstaller/pyinstaller/issues/2742","repository_url":"https://api.github.com/repos/pyinstaller/pyinstaller","labels_url":"https://api.github.com/repos/pyinstaller/pyinstaller/issues/2742/labels{/name}","comments_url":"https://api.github.com/repos/pyinstaller/pyinstaller/issues/2742/comments","events_url":"https://api.github.com/repos/pyinstaller/pyinstaller/issues/2742/events","html_url":"https://github.com/pyinstaller/pyinstaller/issues/2742","id":249812003,"node_id":"MDU6SXNzdWUyNDk4MTIwMDM=","number":2742,"title":"Not running as sudo even added sudo when running under macOS(not sure for linux)","user":{"login":"skys215","id":4977935,"node_id":"MDQ6VXNlcjQ5Nzc5MzU=","avatar_url":"https://avatars2.githubusercontent.com/u/4977935?v=4","gravatar_id":"","url":"https://api.github.com/users/skys215","html_url":"https://github.com/skys215","followers_url":"https://api.github.com/users/skys215/followers","following_url":"https://api.github.com/users/skys215/following{/other_user}","gists_url":"https://api.github.com/users/skys215/gists{/gist_id}","starred_url":"https://api.github.com/users/skys215/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skys215/subscriptions","organizations_url":"https://api.github.com/users/skys215/orgs","repos_url":"https://api.github.com/users/skys215/repos","events_url":"https://api.github.com/users/skys215/events{/privacy}","received_events_url":"https://api.github.com/users/skys215/received_events","type":"User","site_admin":false},"labels":[{"id":147207830,"node_id":"MDU6TGFiZWwxNDcyMDc4MzA=","url":"https://api.github.com/repos/pyinstaller/pyinstaller/labels/OS%20X","name":"OS X","color":"d4c5f9","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2017-08-12T13:23:56Z","updated_at":"2018-08-11T00:38:13Z","closed_at":"2018-06-12T08:48:46Z","author_association":"NONE","body":"Env:\r\nmacOS Sierra\r\nPython3.5.4 (using installer from the python.org)\r\n\r\n`pip3 install keyboard`\r\n\r\n`pip3 install pyinstaller`\r\n\r\n`pip3 install pyobjc-framework-Quartz`\r\n\r\n\r\n```python\r\nimport sys\r\nimport keyboard\r\n\r\nif __name__ == '__main__':\r\n    keyboard.add_hotkey(\"alt+shift+c\", lambda: print('hello'))\r\n    keyboard.wait()\r\n```\r\nsave this code as `kb.py`(short for keyboard).\r\n\r\n\r\nThis may occur under macOS after running `sudo python3 kb.py`,\r\nif there's no error like this, jump to next step:\r\n```\r\nImportError: No module named 'Quartz'\r\n```\r\nFollow [this](https://stackoverflow.com/questions/42530309/no-such-file-requirements-txt-error-while-installing-quartz-module) instruction to install the `quartz` module.\r\n\r\n\r\n\r\nSpec file:\r\n```python\r\n# -*- mode: python -*-\r\nimport sys\r\nblock_cipher = None\r\n\r\na = Analysis(['kb.py'],\r\n             pathex=['./'],\r\n             binaries=[],\r\n             datas=[],\r\n             hiddenimports=[],\r\n             hookspath=[],\r\n             runtime_hooks=[],\r\n             excludes=[],\r\n             cipher=block_cipher)\r\npyz = PYZ(a.pure, a.zipped_data,\r\n             cipher=block_cipher)\r\nexe = EXE(pyz,\r\n          a.scripts,\r\n          a.binaries,\r\n          a.zipfiles,\r\n          a.datas,\r\n          name='kb',\r\n          debug=True,\r\n          strip=False,\r\n          upx=False,\r\n          console=True )\r\n\r\napp = BUNDLE(exe,\r\n        name='kb.app',\r\n\tbundle_identifier='com.skys215.kb',\r\n        info_plist={\r\n            'CFBundleVersion' : '1.0.0',\r\n        })\r\n```\r\n\r\nRun `pyinstaller kb.spec`.\r\n\r\nAfter building, there's two files in the `dist/` folder.\r\n\r\nOne is the executable file, the other one is the .app file.\r\n\r\nRun the executable file with `./dist/kb` and you can see the warning on the console.\r\n\r\n```\r\nException in thread Thread-1:\r\nTraceback (most recent call last):\r\n  File \"threading.py\", line 914, in _bootstrap_inner\r\n  File \"threading.py\", line 862, in run\r\n  File \"site-packages/keyboard/__init__.py\", line 138, in listen\r\n  File \"site-packages/keyboard/_darwinkeyboard.py\", line 400, in listen\r\nOSError: Error 13 - Must be run as administrator\r\n```\r\nOk, then we run with `sudo` as `sudo ./dist/kb`. ( Run `open ./dist/kb` with or without `sudo` will always report this error.)\r\n\r\nNow when we press `alt+shift+c`, we can see the `hello` print on the console.\r\n\r\nSo far so good.\r\n\r\nBut when we run `.app` from console, to see the debug output, nothing is output to the console.\r\n\r\nIf run the `.app` with `sudo`, program exit automatically with no any output.\r\n\r\n\r\n\r\nSo the problem is, the python program is not running with sudo even I added sudo on running.\r\n"},"comment":{"url":"https://api.github.com/repos/pyinstaller/pyinstaller/issues/comments/412238156","html_url":"https://github.com/pyinstaller/pyinstaller/issues/2742#issuecomment-412238156","issue_url":"https://api.github.com/repos/pyinstaller/pyinstaller/issues/2742","id":412238156,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMjIzODE1Ng==","user":{"login":"skys215","id":4977935,"node_id":"MDQ6VXNlcjQ5Nzc5MzU=","avatar_url":"https://avatars2.githubusercontent.com/u/4977935?v=4","gravatar_id":"","url":"https://api.github.com/users/skys215","html_url":"https://github.com/skys215","followers_url":"https://api.github.com/users/skys215/followers","following_url":"https://api.github.com/users/skys215/following{/other_user}","gists_url":"https://api.github.com/users/skys215/gists{/gist_id}","starred_url":"https://api.github.com/users/skys215/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skys215/subscriptions","organizations_url":"https://api.github.com/users/skys215/orgs","repos_url":"https://api.github.com/users/skys215/repos","events_url":"https://api.github.com/users/skys215/events{/privacy}","received_events_url":"https://api.github.com/users/skys215/received_events","type":"User","site_admin":false},"created_at":"2018-08-11T00:38:13Z","updated_at":"2018-08-11T00:38:13Z","author_association":"NONE","body":"Yeah, I'm facing the same problem.\r\nI tried to print `ls -al` and `pwd` before calling the `osascript`, the script exists, but it still return with `No such file or directory`. \r\nMaybe I should try run `pwd` inside the `do shell script` command?\r\n\r\nPs. I have Mac in office, not my home, so I cannot debug it frequently.\r\nPlus, it's my side project to study using PyQt, so I'm lack of motivation to debug it in the past few months/years."}}
{"actor":{"display_login":"skys215"}}