Module does not seem to be imported competely

SyntaxEditor Python Language Add-on for WPF Forum

Posted 4 months ago by Volodymyr Tsymbalistyi
Version: 21.1.1
Platform: .NET 4.8
Environment: Windows 10 (64-bit)
Avatar

I am trying to evaluate Python Syntax editor.

I imported numpy but intellisense does not seem to recognise that there is sqrt function there.

Am I doing something wrong? Or does it have some kind of limitation I am not aware of. All it shows starting from "s" is "setup".

I am using Python 3. I added <pythonfolder>\Lib\site-packages search path to my project.

Thanks,
Volodymyr

[Modified 4 months ago]

Comments (6)

Posted 4 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

After digging into it, I believe what's happening here is that the "sqrt" function is defined in the "_multiarray_umath.xx.pyd" file.  Since it's a .pyd file and not a .py file, we are unable to read it to get reflection data for IntelliPrompt.


Actipro Software Support

Posted 4 months ago by Volodymyr Tsymbalistyi
Avatar

So is there a way for me to utilise bytecode python files?

[Modified 4 months ago]

Posted 4 months ago by Volodymyr Tsymbalistyi
Avatar

I just created a custom py file and it fails to autocomplete anything except module name as well.

All it contains is:

def user_function():
    return 2
Posted 4 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

We are unaware of how to get any reflection data on ".pyd" files at this time.  If you locate any specification on how to read those files from C#, please let us know.  Thus at the current time, we can only load ".py" files for reflection.

For your second comment, please tell us the exact steps to reproduce the issue (project search paths, file names, etc.) so we can try it here.  If the module is imported properly, you should be able to see "user_function".


Actipro Software Support

Posted 3 months ago by Volodymyr Tsymbalistyi
Avatar

Hello,

Regarding pyd consumption https://github.com/pythonnet/pythonnet should help you.

I added syntax editor to the window. Added Sample.py containing path as well as py file itself to project.SearchPaths in window constructor. I can see Sample in a list of imports. But if I "import Sample", i do not see anything in automplete when i try "Sample.".

Please let me know how can I debug this to give you more context. I also tried subscribing to project.Resolver.UnknownReturnTypeReferenceCallback but it did not trigger even once no matter what I did.

Thanks 

[Modified 3 months ago]

Posted 3 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

We haven't used that library before.  Can you put together a simple C# project that shows how to load a particular .pyd file like one of the numpy ones and then enumerate all the modules, functions, etc. within it with enough information to display in IntelliPrompt?  Please remove the project's bin/obj folders from the .zip you send to our support address, and mention this thread in your e-mail.  Thanks!

In regards to Sample.py, if I make a Sample.py file, add your two lines you mentioned in an earlier reply in this thread, add the folder path containing Sample.py as to the project.SearchPaths, I get IntelliPrompt for "Sample" after the import keyword.  I also get auto-complete for "user_function" after "Sample." like here:

import Sample
Sample.

You should not add a .py file's path to the project.SearchPaths, but you can add it's containing folder as a path.

If you still aren't seeing what I described working, please make sure you followed all the steps in the add-on's Getting Started topic.


Actipro Software Support

The latest build of this product (v21.1.3) was released 20 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.