How to debug ns-3 in python - python

when I run a ns-3 simulation written in Python and something fails, I only see this message:
Command ['/usr/bin/python', 'path/to/file.py'] terminated with signal SIGSEGV. Run it under a debugger to get more information (./waf --run <program> --command-template="gdb --args %s <args>").
But I can not see the actual error message.
I run the simulation with:
sudo ./waf --pyrun path/to/file.py
Could somebody tell me how to run the simulation to see the error message?
Thanks!

Related

Process finished with exit code 2

Whenever I am trying to run a object detection program in pycharm, the following error occurs (see the trace). Could you please help to figure out, how to fix it?
C:\Users\Dell\venv\Scripts\python.exe "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.4\helpers\pydev\pydevd.py" --multiproc --qt-support=auto --client 127.0.0.1 --port 11093 --file C:/Users/Dell/Desktop/image.py
pydev debugger: process 2648 is connecting
Connected to pydev debugger (build 183.5429.31)
usage: image.py [-h] -i IMAGE -p PROTOTXT -m MODEL [-c CONFIDENCE]
image.py: error: the following arguments are required: -i/--image, -p/--prototxt, -m/--model
Process finished with exit code 2
Actually i am trying to run the code in the following page
https://www.pyimagesearch.com/2017/09/11/object-detection-with-deep-learning-and-opencv/
My question is where should i copy and paste .......python deep_learning_object_detection.py \
--prototxt MobileNetSSD_deploy.prototxt.txt \
--model MobileNetSSD_deploy.caffemodel --image images/example_01.jpg
In PyCharm, in the Run menu, look for Edit configurations...
Each time you run a new script, a run configuration is created for it and it is here that you can provide command line parameters in the Parameters: box.
You probably only want to past the parameters section there, not the script name, so:
\ --prototxt MobileNetSSD_deploy.prototxt.txt \ --model MobileNetSSD_deploy.caffemodel --image images/example_01.jpg
Another issue you may run into is what working directory your script needs to run in. You can change it from the same dialog, under Working directory:. You'll find that you'll rarely need to change any of the other fields in this dialog, although I would recommend giving it a name that's sensible to you under Name: - by default it's named after the script file it is running.

Yocto Project Bitbake Unexpected Termination

I just got my i.MX 8M Evaluation Kit and I followed the tutorial to make the system for my board.
I build the system on a host machine with Ubuntu 16.04 and I followed all instructions in Section-3 to set up my host machine.
I'm trying to build the Wayland image with OPTEE enabled so the commands are:
$ DISTRO=fsl-imx-wayland MACHINE=imx8mqevk source fsl-setup-release.sh -b build-wayland
Comment two SDL settings in local.conf: PACKAGECONFIG_append_pn-qemu-native = " sdl", PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl"
Enable OPTEE in local.conf
$ bitbake fsl-image-qt5-validation-imx
The issue happens after the "bitbake" command, which is the script would suddenly be stopped and the host machine would be suspended and required re-login. The bitbake command can be continued with "-k" parameter while the unknown termination and re-login process are really annoying to me.
By reviewing the bitbake log file bitbake-cookerdeamon.log, I found that every time before unexpected termination, the bitbake command generates the same logs:
Accepting [<socket.socket fd=7, family=AddressFamily.AF_UNIX,
type=SocketKind.SOCK_STREAM, proto=0, laddr=bitbake.sock>] Connecting
Running command ['updateConfig', ...]
Running command ['getVariable', 'BBINCLUDELOGS']
Running command ['getVariable', 'BBINCLUDELOGS_LINES']
Running command ['getSetVariable', 'BB_CONSOLELOG']
Running command ['getUIHandlerNum']
Running command ['setEventMask', ...]
Running command ['getVariable', 'BB_DEFAULT_TASK']
Running command ['setConfig', 'cmd', 'build']
Running command ['buildTargets', ['fsl-image-qt5-validation-imx'], 'build']
Running command ['stateForceShutdown']
Connecting Client
Disconnecting Client
No timeout, exiting.
Exiting
According to my current understanding, the above commands are only supposed to be executed after all tasks have been prepared. However, right now my host machine may invoke these commands during other tasks are still running, and this incorrect sequence leads to my unexpected termination issue.
I'm wondering if anyone runs to a similar problem or knows the solution to my issue?
Any suggestion is welcomed. Thank you in advance.
Simon
-----Supplemental Information
Here is the content of the configuration file fsl-imx-wayland.conf
# i.MX DISTRO for Wayland without X11
include conf/distro/include/fsl-imx-base.inc include
conf/distro/include/fsl-imx-preferred-env.inc
DISTRO = "fsl-imx-wayland"
# Remove conflicting backends DISTRO_FEATURES_remove = "directfb x11 " DISTRO_FEATURES_append = " wayland pam systemd"

PyCharm/Python. Code doesn't run. Immediately receiving "Getting Process finished with exit code 0"

I recently switched my workstation and reinstalled all my environment on Fedora 25.
When attempting to run any part of my project (I run PyTest tests) I always end up getting "Process finished with exit code 0" message in debug.
Here's the full debug message:
/usr/bin/python2.7 /usr/share/java/pycharm-community/helpers/pydev/pydevd.py --multiproc --qt-support --client 127.0.0.1 --port 46537 --file /home/pavel/Documents/integration_tests/cfme/tests/containers/test_containers_default_project_replicators.py
warning: Debugger speedups using cython not found. Run '"/usr/bin/python2.7" "/usr/share/java/pycharm-community/helpers/pydev/setup_cython.py" build_ext --inplace' to build.
pydev debugger: process 10166 is connecting
Connected to pydev debugger (build 163.10154.50)
/home/pavel/Documents/integration_tests/utils/log.py:222: UserWarning: clearing configuration is bad
del(conf['env'])
The project I am trying to run is actually open sourced and is here for reference:
https://github.com/ManageIQ/integration_tests
Ok, so the problem was that the I tried to run it as Python Run/Debug configuration instead of Py.test run/debug configuration.
From
How do I configure PyCharm to run py.test tests?
Please go to File | Settings | Tools | Python Integrated Tools and change the default test runner to py.test. Then you'll get the py.test option to create tests instead of the unittest one.
In my case, along with the rest of great suggestions, somehow content root was not defined.
Solution: File|Settings|Project Structure -> Add Content Root (Here you select your project folder)
*It took me a looong time for this, hope that this will help somebody :)

Opening a terminal application from python and running custom scripts inside it

I'm working with a software called dc_shell that has a terminal command (also called dc_shell) on a CentOS Linux server. when I run dc_shell command, I'm connected to its terminal and I'm able to run scripts/commands inside it. (This is all done manually)
So the real problem is that I want to do this task all from a Python program. Meaning that I have a Python code which does some task, and after that has to open dc_shell and run some commands inside it.
I have used subprocess.Popen before and this doesn't have any problem when I run commands like ls or other general terminal commands. But when I run dc_shell command it seems like it crashes and nothing happens, and when I try to terminate the session I get the following errors in my terminal.
Here's my code:
def run_scripts():
commandtext = 'cd ..; dc_shell-xg-t; set_app_var link_library "slow.db"; set_app_var target_library "slow.db"; set_app_var symbol_library "tsmc18.sdb";'
print(commandtext)
process = subprocess.Popen(commandtext,stdout=subprocess.PIPE, shell=True)
proc_stdout = process.communicate()[0].strip()
print(proc_stdout)
and the output is:
cd ..; dc_shell-xg-t; set_app_var link_library "slow.db"; set_app_var target_library "slow.db"; set_app_var symbol_library "tsmc18.sdb";
and nothing happens... and after terminating I get:
[User#server python]$ /bin/sh: set_app_var: command not found
/bin/sh: set_app_var: command not found
/bin/sh: set_app_var: command not found
Do you need to use dc_shell to run your commands?
If so, that should be your executable and the rest of commands your arguments.
You should never use shell=True due to security considerations (the warning in the 2.x docs for subprocess seems much clearer to me).

Starting qsub in parent folder with Python fails

I'm creating a Python script to setup a series of calculations on a remote calculation cluster. However I have run into a problem.
The calculation on the remote server is started with the command:
qsub Run.sh
Run.sh is located in the folder ./sol/
If I enter ./sol/ and run:
python25 -c "import os;os.system(\"qsub Run.sh\")"
Every thing works like it should.
However, If I am located in ./ and run this command:
python25 -c "import os;os.chdir(\"sol\");os.system(\"qsub Run.sh\")"
qsub failes with this error message:
*** error from copy
Host key verification failed.
lost connection
*** end error output
Does anyone know why this is? I use python version 2.5.1 and unix 2.6.18

Categories