Debugging in pyCharm with sudo privileges?
Create a shell script that does "sudo python" and forwards the arguments, and configure that script as a Python interpreter in PyCharm.
Name of this shell script should start with python
(source: http://forum.jetbrains.com/message/PyCharm-424-3).
How can I debug a python script from command line using PyCharm?
Short answer: Tools> Attach to Process...
Long anser:
Put a following line at very first of your code
input("press Enter to continue")
Launch your code in shell
myscript.py --input1 ./dir/file1.txt --input2 ./dir/file2.txt
Open Pycharm and use it to open your
myscript.py
. Setbreak points
at anywhere you like to debug. SelectTools> Attach to Process...
and select the process thatmyscript.py
is running.Come back to the shell of
myscript.py
and hitEnter
Trouble you may get: ptrace
don't have permission of doing something
Solution:
sudo su
echo 0 > /proc/sys/kernel/yama/ptrace_scope
or you can set 0 directly in
/etc/sysctl.d/10-ptrace.conf
How to run python file with admin rights in pycharm
Startup pycharm as Administrator then all scripts will be ran as administrator.
From Windows start menu right click the Pycharm shortcut and select 'Run as administrator.' Optionally create a short and change the options to always Run as Administrator under the "Compatibility" tab.
IntelliJ - Running Program as Sudo
I came out with an answer and wanted to share it just in case anyone else runs into this. To solve the problem, I took my cue from what I do with QT & QT Creator when doing network programming.
On OSX, I opened up a terminal window and cd'd down to/Applications/IntelliJ IDEA 9.0.3.app/Contents/MacOS. There you will find a file called idea which launches the IDE. I ran that as sudo (sudo ./idea). That took care of permissions on anything Intellij launched and I could debug and step through my code as needed.
sudo /Applications/IntelliJ IDEA 9.0.3.app/Contents/MacOS/idea
Since this is a dev machine and I am in control of it security is not an issue in this case.
Hope it helps someone else out.
PyCharm For Windows: Debugging Down / Up With Selection Executes Present Line
A workaround for the moment is, to deactivate the option Show value tooltip on code selection
(in Settings/Debugger/Dataview).
PyCharm error: [Errno 13] Permission denied
It looks like you need to give your interpretter root permissions. There is a tutorial here on how to do this
Related Topics
How to Grep Exact Literal String (No Regex)
How to Get Debugging Symbols Working in Linux Perf Tool Inside Docker Containers
How to Change the Soname of a Binary Directly
I Can't Execute Command Modprobe Vboxdrv
How to Specify Time in Cron Considering Year
Bash Scripting - Read Single Keystroke Including Special Keys Enter and Space
/Tmp VS. /Dev/Shm for Temp File Storage on Linux
Effects of Removing All Symbol Table and Relocation Information from an Executable
Setting Up a Workspace Using Team Explorer Everywhere on Linux
A Way to Determine a Process'S "Real" Memory Usage, I.E. Private Dirty Rss
The Meaning of Real, User, and Sys in Output of Linux Time Command
Udev - Run Program on Usb Flash Drive Insert
Copy a Directory Structure with File Names Without Content
Simulate Network Latency on Specific Port Using Tc
Find Command in Bash Script Resulting in "No Such File or Directory" Error Only for Directories
How to Use Cx_Freeze in Linux to Create a Package to Be Used in Windows