Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission denied & CLI Process died while starting Pytg #110

Open
MarcoBuster opened this issue Feb 12, 2017 · 4 comments
Open

Permission denied & CLI Process died while starting Pytg #110

MarcoBuster opened this issue Feb 12, 2017 · 4 comments

Comments

@MarcoBuster
Copy link

MarcoBuster commented Feb 12, 2017

The problem

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/pytg/__init__.py", line 33, in __init__
    self.start_cli(telegram=telegram, pubkey_file=pubkey_file, custom_cli_args=custom_cli_args, port=port)
  File "/usr/local/lib/python3.5/dist-packages/pytg/__init__.py", line 86, in start_cli
    self._proc = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, preexec_fn=preexec_function)
  File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg)
PermissionError: [Errno 13] Permission denied

All folders of tg-cli are chmod-ed with 777 permission and the file is runned by sudo.

EDIT: Fixed by doing tg = Telegram(telegram="/home/marcobuster/tg-cli/tg/bin/telegram-cli", pubkey_file="/home/marcobuster/tg-cli/tg/tg-server.pub")

Now I have this problem:

INFO:pytg:Starting Telegram Executable: "/home/marcobuster/tg-cli/tg/bin/telegram-cli -R -W -P 4458 -k /home/marcobuster/tg-cli/tg/tg-server.pub --json --permanent-peer-ids --permanent-peer-ids"
DEBUG:pytg.sender:Parsing raw: Argument help - <command> (needed)
DEBUG:pytg.sender:Sending command >[disable_preview]  help
<
INFO:pytg:CLI did not responde.
DEBUG:pytg.sender:Parsing raw: Argument help - <command> (needed)
DEBUG:pytg.sender:Sending command >[disable_preview]  help
<
INFO:pytg:CLI did not responde.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/pytg/__init__.py", line 52, in __init__
    raise AssertionError("CLI Process died.")
AssertionError: CLI Process died.

Your environment

I'm using Python 3.5.2 on Linux Ubuntu 16.04.

Steps to reproduce

Import pytg

from pytg import Telegram

Inizialize a Telegram object

tg = Telegram(telegram="/home/marcobuster/tg-cli/tg/", pubkey_file="/home/marcobuster/tg-cli/tg/tg-server.pub")
@luckydonald
Copy link
Owner

Please turn on verbose logging:
https://github.com/luckydonald/pytg#in-case-of-errors

@MarcoBuster
Copy link
Author

MarcoBuster commented Feb 13, 2017

@luckydonald I have fixed by doing this:

tg = Telegram(telegram="/home/marcobuster/tg-cli/tg/bin/telegram-cli", pubkey_file="/home/marcobuster/tg-cli/tg/tg-server.pub")

But now I have this problem:

INFO:pytg:Starting Telegram Executable: "/home/marcobuster/tg-cli/tg/bin/telegram-cli -R -W -P 4458 -k /home/marcobuster/tg-cli/tg/tg-server.pub --json --permanent-peer-ids --permanent-peer-ids"
DEBUG:pytg.sender:Parsing raw: Argument help - <command> (needed)
DEBUG:pytg.sender:Sending command >[disable_preview]  help
<
INFO:pytg:CLI did not responde.
DEBUG:pytg.sender:Parsing raw: Argument help - <command> (needed)
DEBUG:pytg.sender:Sending command >[disable_preview]  help
<
INFO:pytg:CLI did not responde.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/pytg/__init__.py", line 52, in __init__
    raise AssertionError("CLI Process died.")
AssertionError: CLI Process died.

@MarcoBuster MarcoBuster changed the title Permission denied while starting Pytg Permission denied & CLI Process died while starting Pytg Feb 13, 2017
@luckydonald
Copy link
Owner

This usually means the CLI terminated. It shouldn't have done that.

@luckydonald
Copy link
Owner

You can also look for the telegram progress in tools like top (some prefer htop).
Also try what happens if you execute the same arguments you can find in the debug, look for Starting Telegram Executable.

In your case that would be

home/marcobuster/tg-cli/tg/bin/telegram-cli -R -W -P 4458 -k /home/marcobuster/tg-cli/tg/tg-server.pub --json --permanent-peer-ids --permanent-peer-ids

See if that works.
Next you can try the commands it sends yourself.
See Sending command >command< in the debug log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants