How to start curling from the console?

I use Python 3 with Anaconda on Windows 7. I installed Twisted with conda install twisted , and now I'm trying to run twisted (or twistd ?) From the console, but I get this error

'twisted' is not recognized as an internal or external command, operating program, or batch file.

which makes me think that the directory is out of the way, as in this question . Anaconda is installed in C:\Anaconda3 , but even in C:\Anaconda3\Lib\site-packages\twisted there is no twisted.py or twistd.py .

Am I doing something wrong, or am I looking for the wrong place for the files (s)?

Is this a problem because Twisted is not officially porting to Python 3?

+8
python twisted anaconda
Jun 17 '15 at 21:49
source share
3 answers

twistd runs twisted applications (although you can run a script with Twisted code in it, like any other Python file) and should be in the bin inside your Anaconda installation directory, so if you can get conda , you can get twistd .

twisted is the library you use to write code using Twisted, so you cannot run this from the command line.

Here is the Twisted status in Python3 https://twistedmatrix.com/trac/milestone/Python-3.x

And here is a specific twist ticket that is not yet available in Python3, https://twistedmatrix.com/trac/ticket/7497

+4
Jul 14 '15 at 20:17
source share

Do not confuse "Twisted" with " twistd ". When you use " twistd ", you run the program using Python. " twistd " is a Python program that, among other things, can load an application from a .tac file (as you do here).

"Twisted Command Prompt" is a Twisted installer-provided convenience to help people on Windows . All he does is %PATH% to include the directory containing the < twistd program . You can run twistd from a regular command line if you set% PATH% correctly or call it with the full path .

(From How do you launch a Twisted application through Python (and not through Twisted)?

Run:

 set PATH=%PATH%;C:\path\to\twistd.py 

Where in C:\path\to\twistd.py you paste the path into the twistd.py file.

+3
Jul 10 '15 at 13:42
source share

Twisted is a Python library. To use it, you can import it, for example, here is a web server from a twisted home page :

 #!/usr/bin/env python from twisted.web import server, resource from twisted.internet import reactor, endpoints class Counter(resource.Resource): isLeaf = True numberRequests = 0 def render_GET(self, request): self.numberRequests += 1 request.setHeader("content-type", "text/plain") return "I am request #" + str(self.numberRequests) + "\n" endpoints.serverFromString(reactor, "tcp:8080").listen(server.Site(Counter())) reactor.run() 

Save it to a file, for example, counter_server.py and run: py counter_server.py . You can visit http://localhost:8080/ to make sure it works (this is not with version twisted-15.2.1 in Python 3). Twisted is only partially ported to Python 3 (graph based on data from a year ago).

twistd is a Python program that uses the twisted Python package (note: e ). It has not yet migrated to Python 3 ( pip install twisted installs it on Python 2, but it does not install it on Python 3).

+2
Jul 14 '15 at 20:35
source share



All Articles