내가 사용할 수 파이썬에서 CORBA 개발을위한 튜토리얼 다음 : 나는 주어진 IDL 파일에서 파이썬 파일을 생성 한 후 omniORBpy User’s GuideCORBA 파이썬 파일
을, 나는 것으로 나타났습니다 Example 패키지의 init.py
및 Example__POA가 한 수준 아래에 배치 된 echo_example_idl.py
파일을 가져 오려고합니다. 예 모듈에서 init.py의
---Example (module)
|
|------ init.py
|
---Example__POA (module)
|
|------ init.py
|
---echo_example_idl.py
---echo_example.idl
---example_execution.py
내용 : example_execution.py의
# DO NOT EDIT THIS FILE!
#
# Python module Example generated by omniidl
import omniORB
omniORB.updateModule("Example")
# ** 1. Stub files contributing to this module
import echo_example_idl
# ** 2. Sub-modules
# ** 3. End
내용 :
#!/usr/bin/env python
import sys
from omniORB import CORBA, PortableServer
import Example, Example__POA
class Echo_i (Example__POA.Echo):
def echoString(self, mesg):
print "echoString() called with message:", mesg
return mesg
orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
poa = orb.resolve_initial_references("RootPOA")
ei = Echo_i()
eo = ei._this()
poaManager = poa._get_the_POAManager()
poaManager.activate()
message = "Hello"
result = eo.echoString(message)
print "I said '%s'. The object said '%s'." % (message,result)
내가 성공 프로그램을 실행할 수를 다음과 같이 디렉토리 트리 보인다.
두 모듈에 대한 init.py 내부의 import 문은 어떻게 작동합니까? 그것은 omniidl을 통해 생성 된 소스 파일과 동일한 디렉토리에서 example_execution.py를 실행하기 때문입니까?
I (나는 모든 CORBA 소스를 가지고 다른에 내가 example_execution.py 파일을 유지하려는 하려는 하나의 디렉토리에 예를 들어) 소스 파일이있는 디렉토리 외부 실행 파일을 갖고 싶어 내가 진행하는 방법을
. 내가 이렇게하면 나는이 문제를 해결할 수 있었다 echo_example_idl.py