Issues with "twistd" in Twisted 16.4.0

juraseg yuri.abzyanov at gmail.com
Thu Sep 1 06:59:00 EDT 2016


Hi all

I couldn't find Twisted-specific group, so posting here.

Recently Twisted 16.4.0 got released. Yesterday I've tried to upgrade it for my apps and got an error.

I've created simple example, which demonstrates it.
File service.tac:
----------------------------------------
# You can run this .tac file directly with:
#    twistd -ny service.tac

import os
from twisted.application import service, internet

import mymodule

application = service.Application("Demo application")
----------------------------------------


File mymodule.py:
----------------------------------------
def myfunction(asd):
    """ Stub function """
----------------------------------------

If you try to run it with twistd -y service.tac you'll get an error:
>>> Failed to load application: No module named mymodule


The errors comes down to this: twistd script does not add current working directory to python path, so it fails to import any packages/modules from it. It works just fine on previous version (Twisted 16.3.2).

The strange thing here is that it was working before just fine, and I did not find anything related to this in release notes (http://labs.twistedmatrix.com/2016/08/twisted-1640-released.html), except that twistd now is a Setuptools console script (which I honestly don't know how can affect python path).

Any ideas?



More information about the Python-list mailing list