Can I set vscode Python Interpreter to Auto Recognize "import ns.applications"

37 views
Skip to first unread message

Dimes

unread,
Oct 1, 2024, 4:02:51 AM10/1/24
to ns-3-users
I wonder if there is a way to make vscode python interpreter works too? 

For C==, I have set vscode IntelliSense with C++, no peoblem. When coding, hints show up. 

For Python, I can run it with $ ./ns3 run first.py, no problem, this shows that my python binding is configured and built, right?

But I want to have hints when writing python scripts and have hints to tell me what are in those ns functions inside ns.application when I import ns.application, 
Just like when I write pure Python scripts for other projects


Gabriel Ferreira

unread,
Oct 1, 2024, 4:32:16 AM10/1/24
to ns-3-users
If you are using ns-3.37 and onwards, you currently can't. Because bindings are lazily evaluated and don't exist until you try to use them.
If you use dir(ns.applications) to locate symbols, or help(ns.applications.BulkSendApplication) to see functions related to a particular object.
There is apparently a way to support that, with cppyy_add_bindings, but last time I tried it refused to work, so I packaged everything manually and didn't bother with that.
Reply all
Reply to author
Forward
0 new messages