Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Use python to torrent?
-
@ccc did you ever have any success getting Twisted to work? I've moved the files together with zope.interface but no luck getting it to run.
-
zope.interface seems to mostly be written in python, but there is _zope_interface_coptimizations.c which is not. So that doesn't look like it would work in pythonista. Looking through twisted source I see a few c files and some others that I'm not sure about.
Maybe it would be possible to convert those parts?
-
I did not pursue Twisted. If it requires Zope then the odds of getting it working on Pythonista go down a lot :-(.
http://www.ohloh.net/p/zope/analyses/latest/languages_summary
says that Zope is 8.1% C code and 0.4% C++.
http://www.ohloh.net/p/zope3/analyses/latest/languages_summary
says the Zope3 is 1.8% C code.Just because there is C code in a repo does not necessarily mean that that is essential code. It might be just optimization code. Your mileage may vary.
I am not a believer that all packages should be ported over to Pythonista. Those who are considering porting a package over to Pythonista should investigate http://www.ohloh.net at the beginning of their effort.
Also, you should also see if the project has a forum or mailing list and post these questions there: "I am interested to port xxx over to a pure python platform that has no support for C, C#, C++, etc. Do you folks think that my effort has a chance of success? Have any of you already tried to port xxx over to Pythonista for iOS? Is anyone in this community willing to mentor me on this porting effort?". Their answers to these questions may save you a few sleepless nights.
-
FWIW, as best I can tell, Twisted uses Zope.interface as opposed to Zope itself so I'm not sure how much C code is included. Your suggestion of going to the project's forum, at least to assess feasibility, is worthwhile unless someone here has already done the port.
-
I have it working to some degree, I still need to play with it some but zope.interface seems to allow running without errors. btw you beat me to the zope post :)
I'm not sure how to run the tests in pythonista, so I'm running them individually and they seem to work.
-
@briarfox Other than transferring the files for Twisted and zope.interface, what did you need to do to get it working? I have a Twisted-14.0.0 folder and a zope.interface-4.1.1 folder. If I run setup.py in Twisted, I get an ImportError (on line 55):Twisted requires zope.interface 3.6.0 or later, no module named zope.interface.
-
Did you add zope.interface to the sys.path?
-
Sorry if this is really basic but in my /var/mobile/Applications/../Documents directory are the Twisted-14.0.0 and zope.interface-4.1.1 directories. My sys.path (by default) includes the Documents directory and I (obviously incorrectly) thought that the Documents subdirectories would be searched. Can you tell me exactly what I need to append to sys.path to get Twisted to run?
-
ihf I'm new to python so I may not be setting up modules correctly but I can never get the setup.py to run. The Documents folder imports so the modules should import. Make sure that in the zope.interface-4.1.1 has the zope folder directly under it. The default is zope.interface-4.1.1/src/zope Either add the src directory to sys.path.append('path to src') or move the zope folder directly under zope.interface-4.1.1
Again I'm new at this and not sure Twisted is 100% working but I am able to run small examples without error.
It also passes almost all of the tests. It's hangs and doesn't finish near the end though.
-
Thanks. At this point, I'd settle for mostly working. I tried adding the path to src and now I get an error on the same line in setup.py (55) "ImportError:No module named _sysconfigdata. I also get AttributeError {'userbase'}
-
ihf I did not run setup.py I just started using the module. I was able to get simple online examples that use Twisted to run.
-
OK. Another elementary question...if I enter a simple Twisted echo test:
from twisted.internet import protocol, reactor
I get:
No module named internet
I presume this is because the sys.path is not correctly set but nothing I have tried works. Any assistance would be greatly appreciated
-
ihf here is how I import my modules, used as an action script. Put modules in a site-packages dir under Documents
<pre>
import os
import syshome = os.getenv('HOME')+'/Documents/site-packages/'
modules = [home + name for name in os.listdir(home) if not home+name in sys.path]
sys.path.extend(modules)
</pre>Here is my directory listing.
<pre>
Documents/site-packages/Twisted-1.3.0/CREDITS
Documents/site-packages/Twisted-1.3.0/ChangeLog
Documents/site-packages/Twisted-1.3.0/LICENSE
Documents/site-packages/Twisted-1.3.0/README
Documents/site-packages/Twisted-1.3.0/admin
Documents/site-packages/Twisted-1.3.0/debian
Documents/site-packages/Twisted-1.3.0/doc
Documents/site-packages/Twisted-1.3.0/sandbox
Documents/site-packages/Twisted-1.3.0/setup.cfg
Documents/site-packages/Twisted-1.3.0/setup.py
Documents/site-packages/Twisted-1.3.0/static
Documents/site-packages/Twisted-1.3.0/tmlabs
Documents/site-packages/Twisted-1.3.0/twisted
Documents/site-packages/Twisted-1.3.0/win32</pre>
-
I don't have the site-packages directory but I just used /Documents/. I ran your script with this change and my sys.path appears to now include all of the parent directories under /Documents/. If I try "from twisted.internet import protocol, reactor", I get ImportError: Twisted requires zope.interface 3.6.0 or later: no module name zope.interface.Do I have to move the zope and twisted modules out of subdirectories?
-
I added the zope src directory to sys.path. Now "from twisted import..." gives an ImportError: cannot import name symlink
I wonder why you did not experience these problems.
-
If I comment out the "from os import symlink", Twisted appears to run (at least the few test scripts I have tried). I presume that Apple did not permit symlink? I'm not sure where Twisted uses it or what will break without it.
-
It sounds like you guys are making some good progress... Would it be possible for one of you to create a GitHub repo with you code for getting Twisted working on Pythonista? Discussion in this Forum would be more productive if we could look at a common code base. I would be willing to add a few test cases to such a repo if it existed.
-
-
@briarfox The offending line was "from os import symlink". Does that work for you? If not, then it must mean that you are not running "from twisted.internet import protocol, reactor" which is part of an example on the twisted web site.
-
@ihf just ran the example without a simlink error. It worked. Ran the server, ran the client and received a response.
<pre>
Server said: hello, world!
connection lost
Connection lost - goodbye!
</pre>