really like PyDev thanks for all the hard work and dedication, thinking about patreon Friend membership :+1:
because of lack of forum, a more general question: but how to use PyDev in eclipse to debug python programs that need root functionality? (like list logical volumes (lvdisplay) or meassure socket performance?)
or would it be better to run a separate bash script, that repeatedly reads those values as root and writes them to a temporary text file, where python can pick it up? (probably better approach)
thanks
PS: via subprocess would like to send some commands to postgres, but that actually would require root
consider this working script, which tries to interact with postgres + avoiding pip packages (works as root, as non-root it hangs indefinately):
import subprocess
def execute_postgres_command():
try:
# Command to execute
command = 'su - postgres -c "psql -c \\"SELECT version();\\""'
# Execute the command using subprocess
result = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
# Check if the command was successful
if result.returncode == 0:
# Print or process the output
print(result.stdout)
else:
# Print the error message if command failed
print(f"Error: {result.stderr}")
except FileNotFoundError:
print("su command not found. Make sure your environment supports this command.")
# Call the function to execute the command
Hello,
really like PyDev thanks for all the hard work and dedication, thinking about patreon Friend membership :+1:
because of lack of forum, a more general question: but how to use PyDev in eclipse to debug python programs that need root functionality? (like list logical volumes (lvdisplay) or meassure socket performance?)
or would it be better to run a separate bash script, that repeatedly reads those values as root and writes them to a temporary text file, where python can pick it up? (probably better approach)
thanks
PS: via subprocess would like to send some commands to postgres, but that actually would require root consider this working script, which tries to interact with postgres + avoiding pip packages (works as root, as non-root it hangs indefinately):