VisualGDB Python file import problems when debug

Sysprogs forums Forums VisualGDB VisualGDB Python file import problems when debug

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #24555
    julienmercenier
    Participant

    Hi,

    When debugging, I can’t import a python file “Test_CommonFunctions.py” (code : from Test_CommonFunctions import *) even if it is located in the same directory than the script that is run.

    When running the same code directly on the target using command “python Test.py”, while having CommonFunctions.py in the same directory than Test.py, there is no problem.

    This is quite a problem if I do not want to have code duplication.

    VisualGDB version: 5.4.104.3031

    Best regards,

    Julien

    <hr />

    VisualGdb Program Output:

    &”warning: GDB: Failed to set controlling terminal: Operation not permitted\n”
    Traceback (most recent call last):
    File “/tmp/com_sysprogs_PythonDebugWrapper.py”, line 97, in <module>
    com_sysprogs_PythonDebugHelper.Initialize()
    File “/tmp/com_sysprogs_PythonDebugWrapper.py”, line 95, in Initialize
    inst.Launch()
    File “/tmp/com_sysprogs_PythonDebugWrapper.py”, line 89, in Launch
    runpy.run_path(self.DebuggedScript)
    File “/usr/lib/python2.7/runpy.py”, line 252, in run_path
    return _run_module_code(code, init_globals, run_name, path_name)
    File “/usr/lib/python2.7/runpy.py”, line 82, in _run_module_code
    mod_name, mod_fname, mod_loader, pkg_name)
    File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
    exec code in run_globals
    File “/tmp/VisualGDB/c/Local/PRO/DT777/Tests/MSML_PyExt/../Scripts/Test_AcquisitionDelay.py”, line 4, in <module>
    from Test_CommonFunctions import *
    ImportError: No module named Test_CommonFunctions

     

    <hr />

    VisualGDB Diagnostics

    SSH [81]: executing command: export PATH=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin” && export QT_QPA_PLATFORMTHEME=”appmenu-qt5″ && export XDG_DATA_DIRS=”/usr/local/share:/usr/share:/var/lib/snapd/desktop” && “test” -d “/tmp/VisualGDB/c/Local/PRO/DT777/MSML/MSML”
    SSH [81]: command exited with code 0 after 20 msec
    SSH [82]: executing command: cd “/tmp/VisualGDB/c/Local/PRO/DT777/MSML/MSML” && export PATH=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin” && export QT_QPA_PLATFORMTHEME=”appmenu-qt5″ && export XDG_DATA_DIRS=”/usr/local/share:/usr/share:/var/lib/snapd/desktop” && export LANG=”en_US.UTF-8″ && “make” CONFIG=Debug
    SSH [82]: command exited with code 0 after 31 msec
    No deployment host specified for /tmp/VisualGDB/c/Local/PRO/DT777/MSML/MSML/Debug/MSML.so. Skipping…
    SSH [83]: executing command: export PATH=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin” && export QT_QPA_PLATFORMTHEME=”appmenu-qt5″ && export XDG_DATA_DIRS=”/usr/local/share:/usr/share:/var/lib/snapd/desktop” && “test” -d “/tmp/VisualGDB/c/Local/PRO/DT777/Tests/MSML_PyExt”
    SSH [83]: command exited with code 0 after 13 msec
    SSH [84]: executing command: cd “/tmp/VisualGDB/c/Local/PRO/DT777/Tests/MSML_PyExt” && export PATH=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin” && export QT_QPA_PLATFORMTHEME=”appmenu-qt5″ && export XDG_DATA_DIRS=”/usr/local/share:/usr/share:/var/lib/snapd/desktop” && export LANG=”en_US.UTF-8″ && “make” CONFIG=Debug
    SSH [84]: command exited with code 0 after 61 msec
    ShouldRedirectToVisualGDBImpl(): C:\Local\PRO\DT777\Tests\MSML_PyExt\MSML_PyExt-Debug.vgdbsettings
    Searching for active configuration for MSML_PyExt\MSML_PyExt.vcxproj…
    Trying fast lookup…
    Found! Configuration name = Debug
    Searching for active configuration for MSML_PyExt\MSML_PyExt.vcxproj…
    Trying fast lookup…
    Found! Configuration name = Debug
    Searching for active configuration for ..\MSML\MSML\MSML.vcxproj…
    Trying fast lookup…
    Found! Configuration name = Debug
    Locating deployed dependencies for project…
    No deployment host specified for /tmp/VisualGDB/c/Local/PRO/DT777/MSML/MSML/Debug/MSML.so. Skipping…
    SSH [85]: executing command: export PATH=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin” && export QT_QPA_PLATFORMTHEME=”appmenu-qt5″ && export XDG_DATA_DIRS=”/usr/local/share:/usr/share:/var/lib/snapd/desktop” && “test” -f “/tmp/com_sysprogs_PythonBreakpointModule.so”
    SSH [85]: command exited with code 0 after 16 msec
    SSH [86]: executing command: export PATH=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin” && export QT_QPA_PLATFORMTHEME=”appmenu-qt5″ && export XDG_DATA_DIRS=”/usr/local/share:/usr/share:/var/lib/snapd/desktop” && “test” -f “/tmp/com_sysprogs_PythonDebugWrapper.py”
    SSH [86]: command exited with code 0 after 12 msec
    SSH [87]: executing command: cd “/tmp/VisualGDB/c/Local/PRO/DT777/Tests/MSML_PyExt/Debug” && stty -echo && export PATH=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin” && export QT_QPA_PLATFORMTHEME=”appmenu-qt5″ && export XDG_DATA_DIRS=”/usr/local/share:/usr/share:/var/lib/snapd/desktop” && export LANG=”en_US.UTF-8″ && export PYTHONPATH=”${PYTHONPATH}:/tmp/VisualGDB/c/Local/PRO/DT777/Tests/MSML_PyExt/Debug” && “gdb” –interpreter mi –args “python” “/tmp/com_sysprogs_PythonDebugWrapper.py” “/tmp/com_sysprogs_PythonBreakpointModule.so” /tmp/VisualGDB/c/Local/PRO/DT777/Tests/MSML_PyExt/../Scripts/Test_AcquisitionDelay.py
    Creating a temporary SSH console…
    Requesting a temporary console: tty && sleep 2147483647
    Searching for active configuration for MSML_PyExt\MSML_PyExt.vcxproj…
    Trying fast lookup…
    Found! Configuration name = Debug
    [+589265] GDB stop event received
    [+259] GDB stop event received
    SSH [87]: command exited with code 0 after 1833 msec
    Searching for active configuration for MSML_PyExt\MSML_PyExt.vcxproj…
    Trying fast lookup…
    Found! Configuration name = Debug
    Searching for active configuration for MSML_PyExt\MSML_PyExt.vcxproj…
    Trying fast lookup…
    Found! Configuration name = Debug
    Searching for active configuration for MSML_PyExt\MSML_PyExt.vcxproj…
    Trying fast lookup…
    Found! Configuration name = Debug
    Searching for active configuration for MSML_PyExt\MSML_PyExt.vcxproj…
    Trying fast lookup…
    Found! Configuration name = Debug
    Searching for active configuration for MSML_PyExt\MSML_PyExt.vcxproj…
    Trying fast lookup…
    Found! Configuration name = Debug
    Searching for active configuration for MSML_PyExt\MSML_PyExt.vcxproj…
    Trying fast lookup…
    Found! Configuration name = Debug
    Searching for active configuration for MSML_PyExt\MSML_PyExt.vcxproj…
    Trying fast lookup…
    Found! Configuration name = Debug
    Searching for active configuration for MSML_PyExt\MSML_PyExt.vcxproj…
    Trying fast lookup…
    Found! Configuration name = Debug
    Searching for active configuration for MSML_PyExt\MSML_PyExt.vcxproj…
    Trying fast lookup…
    Found! Configuration name = Debug
    Searching for active configuration for MSML_PyExt\MSML_PyExt.vcxproj…
    Trying fast lookup…
    Found! Configuration name = Debug
    Searching for active configuration for MSML_PyExt\MSML_PyExt.vcxproj…
    Trying fast lookup…
    Found! Configuration name = Debug
    SSH [88]: executing command: export PATH=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin” && export QT_QPA_PLATFORMTHEME=”appmenu-qt5″ && export XDG_DATA_DIRS=”/usr/local/share:/usr/share:/var/lib/snapd/desktop” && “test” -d “/tmp/VisualGDB/c/Local/PRO/DT777/MSML/MSML”
    SSH [88]: command exited with code 0 after 29 msec
    SSH [89]: executing command: cd “/tmp/VisualGDB/c/Local/PRO/DT777/MSML/MSML” && export PATH=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin” && export QT_QPA_PLATFORMTHEME=”appmenu-qt5″ && export XDG_DATA_DIRS=”/usr/local/share:/usr/share:/var/lib/snapd/desktop” && export LANG=”en_US.UTF-8″ && “make” CONFIG=Debug
    SSH [89]: command exited with code 0 after 42 msec
    No deployment host specified for /tmp/VisualGDB/c/Local/PRO/DT777/MSML/MSML/Debug/MSML.so. Skipping…
    SSH [90]: executing command: export PATH=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin” && export QT_QPA_PLATFORMTHEME=”appmenu-qt5″ && export XDG_DATA_DIRS=”/usr/local/share:/usr/share:/var/lib/snapd/desktop” && “test” -d “/tmp/VisualGDB/c/Local/PRO/DT777/Tests/MSML_PyExt”
    SSH [90]: command exited with code 0 after 19 msec
    SSH [91]: executing command: cd “/tmp/VisualGDB/c/Local/PRO/DT777/Tests/MSML_PyExt” && export PATH=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin” && export QT_QPA_PLATFORMTHEME=”appmenu-qt5″ && export XDG_DATA_DIRS=”/usr/local/share:/usr/share:/var/lib/snapd/desktop” && export LANG=”en_US.UTF-8″ && “make” CONFIG=Debug
    SSH [91]: command exited with code 0 after 47 msec
    ShouldRedirectToVisualGDBImpl(): C:\Local\PRO\DT777\Tests\MSML_PyExt\MSML_PyExt-Debug.vgdbsettings
    Searching for active configuration for MSML_PyExt\MSML_PyExt.vcxproj…
    Trying fast lookup…
    Found! Configuration name = Debug
    Searching for active configuration for MSML_PyExt\MSML_PyExt.vcxproj…
    Trying fast lookup…
    Found! Configuration name = Debug
    Searching for active configuration for ..\MSML\MSML\MSML.vcxproj…
    Trying fast lookup…
    Found! Configuration name = Debug
    Locating deployed dependencies for project…
    No deployment host specified for /tmp/VisualGDB/c/Local/PRO/DT777/MSML/MSML/Debug/MSML.so. Skipping…
    SSH [92]: executing command: export PATH=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin” && export QT_QPA_PLATFORMTHEME=”appmenu-qt5″ && export XDG_DATA_DIRS=”/usr/local/share:/usr/share:/var/lib/snapd/desktop” && “test” -f “/tmp/com_sysprogs_PythonBreakpointModule.so”
    SSH [92]: command exited with code 0 after 21 msec
    SSH [93]: executing command: export PATH=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin” && export QT_QPA_PLATFORMTHEME=”appmenu-qt5″ && export XDG_DATA_DIRS=”/usr/local/share:/usr/share:/var/lib/snapd/desktop” && “test” -f “/tmp/com_sysprogs_PythonDebugWrapper.py”
    SSH [93]: command exited with code 0 after 15 msec
    SSH [94]: executing command: cd “/tmp/VisualGDB/c/Local/PRO/DT777/Tests/MSML_PyExt/Debug” && stty -echo && export PATH=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin” && export QT_QPA_PLATFORMTHEME=”appmenu-qt5″ && export XDG_DATA_DIRS=”/usr/local/share:/usr/share:/var/lib/snapd/desktop” && export LANG=”en_US.UTF-8″ && export PYTHONPATH=”${PYTHONPATH}:/tmp/VisualGDB/c/Local/PRO/DT777/Tests/MSML_PyExt/Debug” && “gdb” –interpreter mi –args “python” “/tmp/com_sysprogs_PythonDebugWrapper.py” “/tmp/com_sysprogs_PythonBreakpointModule.so” /tmp/VisualGDB/c/Local/PRO/DT777/Tests/MSML_PyExt/../Scripts/Test_AcquisitionDelay.py
    Creating a temporary SSH console…
    Requesting a temporary console: tty && sleep 2147483647
    Searching for active configuration for MSML_PyExt\MSML_PyExt.vcxproj…
    Trying fast lookup…
    Found! Configuration name = Debug
    [+43007] GDB stop event received
    [+249] GDB stop event received
    SSH [94]: command exited with code 0 after 1768 msec

    <hr />

    GDB session : see attach

     

     

     

    Attachments:
    You must be logged in to view attached files.
    #24566
    support
    Keymaster

    Hi,

    Please try setting the PYTHONPATH variable to point to the directory on the board where the Python scripts are uploaded. You can set it via VisualGDB Project Properties ->Debug Settings -> Common Settings -> Debug Mode -> Additional Environment. This should ensure Python can find import all the necessary modules.

    #24811
    julienmercenier
    Participant

    Thank you for the help,

    This solved my problem.

     

    BR,

    Julien

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.