Skip to content

embbed in c#,can't not import dotnet namespace of the host. #1489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
heartacker opened this issue Jul 13, 2021 · 3 comments · Fixed by #1530
Closed

embbed in c#,can't not import dotnet namespace of the host. #1489

heartacker opened this issue Jul 13, 2021 · 3 comments · Fixed by #1530

Comments

@heartacker
Copy link

Environment

  • Pythonnet version:3.0.0-preview2021-06-04
  • Python version:3.7.9
  • Operating System:1607 64bit
  • .NET Runtime: donet core 3.1.408(64bit)

Details

  • Describe what you were trying to get done.

    embbed the Pythonnet to ATC.Studio wpf app, and after upgrade to pythonnet 3.0

    pythonnet can't not import the ATC.Studio, and it work when pythonnet is 2.5

  • What commands did you run to trigger this issue? If you can provide a
    Minimal, Complete, and Verifiable example
    this will help us understand the issue.

try
{
    Py.Import("ATC.Studio");
}
Message:	object is not a module
TypeName:	object is not a module
StackTrc:	   at Python.Runtime.PyScope..ctor(IntPtr ptr, PyScopeManager manager)
   at Python.Runtime.PyScope..ctor(NewReference& reference, PyScopeManager manager)
   at Python.Runtime.PyModule..ctor(NewReference& reference)
   at Python.Runtime.PyModule.Import(String name)
   at Python.Runtime.Py.Import(String name)
   at ATC.Studio.CodeStudio.ExecuteCode(String codestr, TestSettings settings, RunFlagType rflg, String filepath, Dictionary`2 psValue, PyDict locals) in F:\ATCProjectFiles\AutoTool_SVN\atcgui\ATC.Studio\CodeStudio.xaml.cs:line 683
Code end
@filmor
Copy link
Member

filmor commented Jul 13, 2021

This example is neither complete nor verifiable. Can you please try to create a minimal project that shows the behaviour? We have recently merged #1369 which is quite a big change for the import system, so it would be good to debug an actual regression.

@filmor
Copy link
Member

filmor commented Aug 5, 2021

Feel free to reopen if you can provide a reproducible example.

@filmor filmor closed this as completed Aug 5, 2021
@lostmsu
Copy link
Member

lostmsu commented Aug 25, 2021

Found a way to reproduce this.

@lostmsu lostmsu reopened this Aug 25, 2021
lostmsu added a commit to losttech/pythonnet that referenced this issue Aug 25, 2021
… not everything that can be imported is PyModule

fixes pythonnet#1489
lostmsu added a commit that referenced this issue Aug 25, 2021
… not everything that can be imported is PyModule

fixes #1489
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants