473,388 Members | 1,092 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

tinyp2p - trying to get it to work

Hello

I am doing a small research and I found this:

http://www.freedom-to-tinker.com/tinyp2p.html

I tried to get it to work. So far I managed to run it as a server using
a command:
python tinyp2p.py haslo server 10.10.10.1 2233
It starts listening on a given port so I assume it works fine (I can
telnet from other machine to 10.10.10.1 on 2233)

Now when I try to run a client using following command:
python tinyp2p.py haslo client http://10.10.10.1:2233 koniki
it gives me some strange output and erros:
Traceback (most recent call last):
File "tinyp2p.py", line 14, in ?
for url in pxy(ar[3]).f(pw(ar[3]),0,[]):
File "/usr/lib/python2.4/xmlrpclib.py", line 1096, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.4/xmlrpclib.py", line 1383, in __request
verbose=self.__verbose
File "/usr/lib/python2.4/xmlrpclib.py", line 1147, in request
return self._parse_response(h.getfile(), sock)
File "/usr/lib/python2.4/xmlrpclib.py", line 1286, in _parse_response
return u.close()
File "/usr/lib/python2.4/xmlrpclib.py", line 744, in close
raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 1: 'exceptions.TypeError:coercing to Unicode:
need string or buffer, list found'>

Can anybody help me to solve this? Please. I did browse google but found
nothing.

Regards
Fantus.
Oct 7 '07 #1
3 5406
Fantus <fa****@poczta.fmwrote:
Hello

I am doing a small research and I found this:

http://www.freedom-to-tinker.com/tinyp2p.html
[...]
Now when I try to run a client using following command:
python tinyp2p.py haslo client http://10.10.10.1:2233 koniki

it gives me some strange output and erros:
Traceback (most recent call last):
File "tinyp2p.py", line 14, in ?
for url in pxy(ar[3]).f(pw(ar[3]),0,[]):
File "/usr/lib/python2.4/xmlrpclib.py", line 1096, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.4/xmlrpclib.py", line 1383, in __request
verbose=self.__verbose
File "/usr/lib/python2.4/xmlrpclib.py", line 1147, in request
return self._parse_response(h.getfile(), sock)
File "/usr/lib/python2.4/xmlrpclib.py", line 1286, in _parse_response
return u.close()
File "/usr/lib/python2.4/xmlrpclib.py", line 744, in close
raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 1: 'exceptions.TypeError:coercing to Unicode:
need string or buffer, list found'>
Can anybody help me to solve this? Please. I did browse google but found
nothing.
I had a (not so quick) look. The code proves its point (i.e. writing a
very small p2p application is possible), but it is horrible. With only
one server, the code is broken; maybe it works using multiple servers, I
didn't test. A quick fix seems to be to change the line
pr() and [aug(s) for s in aug(pr()[0])]
to
pr() and [aug(s) for s in aug(pr()[0])] or pr([myU])

Please don't take tinyp2p.py as an example on writing python.

HTH Marc
Oct 8 '07 #2
Marc Christiansen pisze:
>Can anybody help me to solve this? Please. I did browse google but found
nothing.

I had a (not so quick) look. The code proves its point (i.e. writing a
very small p2p application is possible), but it is horrible. With only
one server, the code is broken; maybe it works using multiple servers, I
didn't test. A quick fix seems to be to change the line
pr() and [aug(s) for s in aug(pr()[0])]
to
pr() and [aug(s) for s in aug(pr()[0])] or pr([myU])

Please don't take tinyp2p.py as an example on writing python.

HTH Marc
It seems to be working! Respect.

I know this app is a bit messy but I couldnt't find anything else that
would implement p2p basics and wouldn't have hundrends or thousands of
lines of code. I need something very simple and this is fine.

Thank you Marc!
Oct 8 '07 #3
Marc Christiansen pisze:
>
I had a (not so quick) look. The code proves its point (i.e. writing a
very small p2p application is possible), but it is horrible. With only
one server, the code is broken; maybe it works using multiple servers, I
didn't test. A quick fix seems to be to change the line
pr() and [aug(s) for s in aug(pr()[0])]
to
pr() and [aug(s) for s in aug(pr()[0])] or pr([myU])

Please don't take tinyp2p.py as an example on writing python.

HTH Marc

Ok, this seems to work "fine" (as much as a program designed to be
minimalistic can do) except it can't download files larger than 10kb.

It looks like a problem with SimpleXMLRPCServer (or at least I think so...)

While trying to download file larger than 10kb the server itself doesn't
crash but generates output like this:
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 44817)
Traceback (most recent call last):
File "SocketServer.py", line 222, in handle_request
self.process_request(request, client_address)
File "SocketServer.py", line 241, in process_request
self.finish_request(request, client_address)
File "SocketServer.py", line 254, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "SocketServer.py", line 521, in __init__
self.handle()
File "BaseHTTPServer.py", line 316, in handle
self.handle_one_request()
File "BaseHTTPServer.py", line 310, in handle_one_request
method()
File "SimpleXMLRPCServer.py", line 445, in do_POST
self.wfile.write(response)
File "socket.py", line 248, in write
self.flush()
File "socket.py", line 235, in flush
self._sock.sendall(buffer)
error: (104, 'Connection reset by peer')
----------------------------------------
The client that was trying to make a download generates this:

Traceback (most recent call last):
File "backup5.py", line 75, in ?
(lambda fi:fi.write(proxy(url).f(pw(url),2,fn)) or
fi.close())(file(fn,"wc"))
File "backup5.py", line 75, in <lambda>
(lambda fi:fi.write(proxy(url).f(pw(url),2,fn)) or
fi.close())(file(fn,"wc"))
File "/usr/lib/python2.4/xmlrpclib.py", line 1096, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.4/xmlrpclib.py", line 1383, in __request
verbose=self.__verbose
File "/usr/lib/python2.4/xmlrpclib.py", line 1147, in request
return self._parse_response(h.getfile(), sock)
File "/usr/lib/python2.4/xmlrpclib.py", line 1281, in _parse_response
p.feed(response)
File "/usr/lib/python2.4/xmlrpclib.py", line 527, in feed
self._parser.Parse(data, 0)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 5,
column 15
Should I post this in a separate thread or maybe one of experts visiting
this group will take a look and hopefully solve my problem?

Thank you in advance.
Oct 9 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Marcus | last post by:
I am trying to auto-detect what folder a file is sitting in and based upon this info, query a MySQL database to get further information. I have been all over php.net and been through numerous...
5
by: Patrice FRITSCH | last post by:
I'm trying to run a batch file from an asp page using WScript.Shell object. Dim oWSH set oWSH= Server.CreateObject("WScript.Shell") call oWSH.Run("cmd.exe /c " & szCmd , 0, true) szCmd...
1
by: Larry | last post by:
I am a C++/Java programmer trying to get going with some simpe xml transformations at work here. I bought the O'Reilly book Learning xlst for kicks. Someone at work sent me this xml shown below,...
16
by: Andrew Baker | last post by:
I am trying to write a function which provides my users with a file filter. The filter used to work just using the VB "Like" comparision, but I can't find the equivilant in C#. I looked at...
6
by: Frank Wilson | last post by:
Tom, It sounds to me like ASP, not ASP.NET is handling the request for WebForm1.aspx. This is most likely an IIS config issue that may have been caused by order of installation or...
6
by: Larry Woods | last post by:
I am trying to name my submenus (MainMenu control) and they show up in the menu dropdown...like they are O.K., but when I check my controls the names are still "MenuItemX". OTOH, the top-level...
6
by: AppleBag | last post by:
I'm having the worst time trying to login to myspace through code. Can someone tell me how to do this? Please try it yourself before replying, only because I have asked this a couple of times in...
7
by: AAaron123 | last post by:
Me.FindControl("MissionScheduleID"), below returns null. Do you know what I'm doing wrong? Thanks ***In my .aspx file I have: asp:Content ID="Content3"...
2
by: angi35 | last post by:
Hi, I'm working in Access 2000. I have a form with a series of date fields, showing the progress of a project from start to completion. There's a set of fields/controls for projected dates (when...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.