httpimport icon indicating copy to clipboard operation
httpimport copied to clipboard

import public github

Open priamai opened this issue 2 years ago • 4 comments

Hello, I am not sure what I am doing wrong but this should work right?v

with httpimport.github_repo('priamai','stixorm',ref='master'):
  import stixorm
  from stixorm.module.typedb import TypeDBSink,TypeDBSource

I am getting an:


ImportError: cannot import name 'TypeDBSink' from 'stixorm.module.typedb' (https://raw.githubusercontent.com/priamai/stixorm/master/stixorm/module/typedb.py)


---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.

priamai avatar Mar 01 '23 14:03 priamai

In this case you are doing nothing wrong! Just importing specific objects from a module is not supported. Try using them with full names:

with httpimport.github_repo('priamai','stixorm',ref='master'):
  # import the whole submodule
  from stixorm.module import typedb
# Use here
typedb.TypeDBSink
typedb.TypeDBSource

operatorequals avatar Mar 01 '23 15:03 operatorequals

Ops I see, but I am running your code and getting this:

AttributeError: module 'stixorm.module.typedb' has no attribute 'TypeDBSink'

My version:

pip install httpimport==1.3.0

priamai avatar Mar 01 '23 15:03 priamai

I see. Give me some time and I'll return to that issue. Until then you can try importing every submodule one by one.

operatorequals avatar Mar 01 '23 16:03 operatorequals

Hey, can you check if the problem is solved in v1.3.1?

Looks like it could be related to https://github.com/operatorequals/httpimport/issues/53

operatorequals avatar Jul 26 '23 08:07 operatorequals