question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Python debugger stop without message and no Exception in external dll execution

See original GitHub issue

Environment data

  • VS Code version: 1.26.1
  • Extension version (available under the Extensions sidebar): 2018.7.1
  • OS and version: Windows 8 32bit
  • Python version (& distribution if applicable, e.g. Anaconda): Python 2.7 32bit
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): N/A
  • Relevant/affected Python packages and their versions:

I’m writing an application that use pcshll32.dll to communicate with IBM Pcomm 3270 terminal. I’m able to use the dll successful but there is some commands that when executed no exceptions occurs and the debugger stops. When I execute the same code but calling $ python index.py from VSCode terminal everything works as

code used:

from ctypes import c_int, c_char_p, WinDLL, WINFUNCTYPE, byref, c_void_p
import os
hllDll = WinDLL("pcshll32.dll")
hllApiProto = WINFUNCTYPE(c_int, c_void_p, c_void_p, c_void_p, c_void_p)
hllApiParams = (1, "f", 0), (1, "d", 0), (1, "l", 0), (1, "p", 0)
hllApi = hllApiProto(("hllapi", hllDll), hllApiParams)
f = c_int(1)
d = c_char_p(b"A")
l = c_int(1)
p = c_int(0)
res = hllApi(byref(f), d, byref(l), byref(p))
if (res == 0):
    f = c_int(5)
    d = c_char_p("")
    l = c_int(1)
    p = c_int(0)
    txt = c_char_p("")
    r2 = hllApi(byref(f), d, byref(l), byref(p))
    print(res, r2)
    f = c_int(2)
    d = c_char_p("")
    l = c_int(0)
    p = c_int(0)
    res = hllApi(byref(f), d, byref(l), byref(p))

Expected behavior

To print both response. But I’m not able to pass through line 18, no Exceptions occurs and python end execution. But in with $ python index.py i’m can make it run as expected.

Steps to reproduce:

Need to install pcomm ibm software, configure a session to

I’m using host: zos.kctr.marist.edu with port 1023 to test the program.

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

no output message

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

no output message

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
ommeirellescommented, Sep 5, 2018

@brettcannon I changed my env to use c# and worked for me. I just posted here to improve the debugger cause i love python. Thanks for your support

0reactions
brettcannoncommented, Sep 4, 2018

@ommeirelles I’m afraid we aren’t in a good position to fix this. You’re calling into C code using ctypes which automatically means “magic” 😉 . Add on top of that the fact that the IBM docs say the return value is undefined, which suggests this is “black magic” 😉 . And the debugger doesn’t work with C code. If you can figure out what object res is and then report that up to https://github.com/microsoft/ptvsd, but otherwise I don’t see how we can reproduce this in order to debug it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python debugger stop without message and no Exception in ...
I'm writing an application that use pcshll32.dll to communicate with IBM Pcomm 3270 terminal. I'm able to use the dll successful but there...
Read more >
Manage exceptions with the debugger in Visual Studio
When an exception occurs, the debugger writes an exception message to the Output window. It may break execution in the following cases when:....
Read more >
The application is in break mode - Unable to determine cause
Clicking "Continue executing" quits debugging seemingly normally. Clicking "Show diagnostic tools" shows the event "Stop at Execution: Stopped ...
Read more >
Debug & Catch Exceptions in Visual Studio: The Complete ...
Debug & Catch Exceptions in Visual Studio: The Complete Guide ... When a First Chance Exception is thrown, the execution will not terminate....
Read more >
sys — System-specific parameters and functions — Python ...
sys.audit() will call the existing auditing hooks, passing the event name and arguments, and will re-raise the first exception from any hook. In...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found