Comments (5)
@lilothar Try: import test_pb2
from codon.
how to import protobuf generations?
from codon.
@elisbyberi I have try that, but raise error too
test_pb2.py:5:4-23: error: cannot import name 'version_info' from 'sys'
test_pb2.py:6:6-30: error: no module named 'google.protobuf.internal'
test_pb2.py:7:6-21: error: no module named 'google.protobuf'
test_pb2.py:8:6-21: error: no module named 'google.protobuf'
test_pb2.py:9:6-21: error: no module named 'google.protobuf'
test_pb2.py:10:6-21: error: no module named 'google.protobuf'
test_pb2.py:13:11-37: error: no module named '_symbol_database'
another example that define a class A,
class A:
x: int
def __init__(self, x):
self.x = x
codon test file: a_test.codon
from python import ftest
print(ftest.A(1).x)
codon run a_test.codon will run ok
if define a as
class A:
def __init__(self, y: int):
self.x: int = y
this will case the same type error with using protobuf as bellow
error: 'pyobj' object has no attribute 'x'
I guss if I want to import a python class, I should definitely define the data member with type in python, thus to protobuf,
I need to write same plugin to regenerate the code as required or same proxy to adapter it?
from codon.
@lilothar Refer to: https://docs.exaloop.io/codon/interoperability/python for information on how to work with the google.protobuf library. TL;DR: You have to import it from Python using from python import [specific_module]
Note that a 'Python module' is a pip-installed Python module (importable from the Python runtime). If you want to import a Python script (from the same directory), you can simply use import script_file
.
from codon.
@elisbyberi I have try that method, but no effect and raise
test_pb2.py:5:4-23: error: cannot import name 'version_info' from 'sys'
test_pb2.py:6:6-30: error: no module named 'google.protobuf.internal'
test_pb2.py:7:6-21: error: no module named 'google.protobuf'
test_pb2.py:8:6-21: error: no module named 'google.protobuf'
test_pb2.py:9:6-21: error: no module named 'google.protobuf'
test_pb2.py:10:6-21: error: no module named 'google.protobuf'
test_pb2.py:13:11-37: error: no module named '_symbol_database'
``` error
from codon.
Related Issues (20)
- simd program HOT 2
- 'Generator[Dict[str,pyobj]]' object has no attribute '__to_py__' HOT 1
- Is there a way to quickly debug a simple unit test?
- How to link codon LLVM and functions of clang LLVM? HOT 1
- how to run python project HOT 1
- The result of assert is changed with/without a print statement. HOT 1
- how can I add plugin HOT 2
- Any pre-built binaries for Linux (x86_64) with CUDA enabled for downloading? HOT 1
- Pre-built binaries for Windows HOT 1
- Why did some AST copy in some places and then assign values to themselves? HOT 1
- Unbuffered output HOT 1
- Inheritance between 3 classes gives an infer.cpp error HOT 1
- Error: no member named 'ExecutorSymbolDef' in namespace 'llvm::orc'
- how to integration c++ class
- bench/set_partition c++ error: no matching function for call to 'partition_filtered' HOT 2
- Build process for the jupyter plugin stops midway (MacOS)
- TypeVar and ParamSpec type expression fail HOT 5
- What is the difference between the support for reflection in Codon and Python? HOT 1
- CURSED HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from codon.