0

I am trying to start a socket connection in amazon AMI server, for that I have some existing code which is in python, I am a newbie to python and unable to start that, As I am trying to start that program using this command, I am facing some issues, please check this

from twisted.application import internet, service
from udpecho import Echo

application = service.Application("echo")
echoService = internet.UDPServer(7401, Echo())
echoService.setServiceParent(application)

but its showing error

Traceback (most recent call last):
  File "/usr/lib64/python2.6/dist-packages/twisted/application/app.py", line 694, in run
    runApp(config)
  File "/usr/lib64/python2.6/dist-packages/twisted/scripts/twistd.py", line 23, in runApp
    _SomeApplicationRunner(config).run()
  File "/usr/lib64/python2.6/dist-packages/twisted/application/app.py", line 411, in run
    self.application = self.createOrGetApplication()
  File "/usr/lib64/python2.6/dist-packages/twisted/application/app.py", line 494, in createOrGetApplication
    application = getApplication(self.config, passphrase)
--- <exception caught here> ---
  File "/usr/lib64/python2.6/dist-packages/twisted/application/app.py", line 505, in getApplication
    application = service.loadApplication(filename, style, passphrase)
  File "/usr/lib64/python2.6/dist-packages/twisted/application/service.py", line 390, in loadApplication
    application = sob.loadValueFromFile(filename, 'application', passphrase)
  File "/usr/lib64/python2.6/dist-packages/twisted/persisted/sob.py", line 215, in loadValueFromFile
    exec fileObj in d, d
  File "udp_server.tac", line 4, in <module>
    from udpecho import Echo
exceptions.ImportError: No module named udpecho

Failed to load application: No module named udpecho

What should I do for this to run? Any Working solution is appreciable

Dhanu K
  • 11,288
  • 6
  • 24
  • 38
  • @sshashank124, may I know the reason why u changed the tag to bash? – Dhanu K Dec 28 '19 at 08:14
  • The question is not relevant to python. Rather it is relevant to how you have setup your environment and PATH – sshashank124 Dec 28 '19 at 08:15
  • is there anything to do in PATH regarding twistd, Please let me know – Dhanu K Dec 28 '19 at 08:17
  • Thanks to @sshashank124, I have added twistd location to PATH, even after I am seeing this error while starting – Dhanu K Dec 28 '19 at 08:27
  • Question updated please check @sshashank124 – Dhanu K Dec 28 '19 at 08:27
  • Do you have a local module or installed module named udpecho? – sshashank124 Dec 28 '19 at 08:29
  • I have two files named udpecho.py and udpecho.pyc in the same directory where I am executing this – Dhanu K Dec 28 '19 at 08:31
  • I'm not familiar with the details of your setup, but it seems that your file is being executed from another location, therefore it might be an issue with the python import path. Something like [this](https://stackoverflow.com/questions/6323860/sibling-package-imports) might help but it's a complete guess. I'd wait for someone who knows about this to answer – sshashank124 Dec 28 '19 at 08:34

0 Answers0