pyfs: Python File Server
|Remote sessions and file-transfer
between cell phones, PC and XBOX, running Python
Pyfs is a (sort of) python replacement for shell+rsh+ftp+telnet,
in a very alpha development
stage. Pyfs works on every platforms supporting Python, with network
in mind. Having the pyfs server running on the machine A (a PC, a Nokia phone with Symbian S60, an XBOX console), you can connect to A
from another machine B (using the pyfs client), either via TCP, either
via Bluetooth. After the connection is established, you can interact
with the remote python shell on A, or also start a form of UNIX-like
shell on A, with commands like cp,
rm, ls, mkdir, etc, and even transfer files, in both
The name is pyfs because pyshell is already used by another
PyFS is written in a minimal Python, with the portability in
mind. The programming style is poor, maybe just acceptable?, and the
program crashs at the end. Other bugs are in
progress. And, yes: it basically works.
Thank You for suggestions and improvements.
- Linux ( with Python 2.4.2)
- Nokia N70 (with py60, the Python for Symbian-60 machines)
- XBOX (with xbmc and Python)
- Win32 (PC running win xp)
Network stacks supported
TCP/IP over ethernet for XBOX, LINUX e Win32; Bluetooth for
Symbian (using bluez BT stack on the linux side).
Network communication is pyfs is realized using simple sockets (see my implementation in stream.py). I wrapped every socket
call in a python class called stream.
The stream class transfers data using small chunks, adding
control check (CRC32) and other machinery.
Pyfs as remote python console
Pyfs is a server/client command-line suite. As example scenario,
we run "server.py" on the N70 cell phone and connect to it from
a Linux box via Bluetooth, but the same should happen for other
If the address of your phone is, for example, 00:16:4E:D3:75:55, and
the its BT channel is 13, you must run the client on the linux box
executing the command:
# client.py 00:16:4E:D3:75:55 13
(in windows, you must write python
client.py, instead, etc)
After that, you will have the usual python prompt from the cell phone:
Connecting to 00:16:4E:D3:75:55,
via BT port 13
peername ('00:16:4E:D3:75:55', 13)
Proto=CRC32; platform symbian_s60; mode=BT; port=13
Python version: 2.2.2 (#0, Sep 26 2005, 11:38:57)
[GCC 2.9-psion-98r2 (Symbian build 546)]
Server ready; please, tupe stuff.
Now You can interact with the powerfull Python environment
in the usual way (see the Python manual).
In order to avoid confusion, the python
prompt in pyfs is ">>" and not ">>>".
Pyfs as remote unix-like shell
After you have the python prompt, you can run the special
and the shell will start:
UNIX-LIKE Shell, Platform: symbian_s60
Help: write 'help', or 'man command'
Quit with 'exit'
ball.py imgviewer.py Python_aif.mif
bt_console.py interactive_console.py Python.app
default.py keyviewer.py Python.rsc
fibo.py my/ series60_console.py
filebrowser.py phpush.py snake.py
Now you can remove files (rm), copy files and directory
recursively (cp), and all the other stuff you usally expect in a
shell. See man pages.
Notes about the pyfs shell
The shell built-in in pyfs is absolutely not-complete, but
supports wildcards, regular-expressions,
manual pages,with the 'man' commands:
# man cp
The pyfs shell supports the commands history, if your python "readline"
module supports the feature (for example, Linux does).
# cd E:\
# mkdir tmp\img
# cp -r E:\Images\*.jpg E:\sounds\*.mp3 E:\tmp
# ls E:\system\libs\*.dll
# rm -r E:\tmp
Pyfs as file-server
Being under the shell, you can trasfer files from server and
the two commands:
- rx receive files from the client
- tx transmit files to the client
I used different names from those used in the FTP/SSH world, in
order to avoid confusion.
# tx *.jpg *2006*.jpg /tmp/nokia
Pyfs as stand-alone shell
If you just have no xbox console, no Nokia phones with python, no
linux boxes, you can still use pufs as stand-alone shell of
To run pyfs as stand-alone shell, please execute the command:
A simple (experimental) utility called gps, allow you to connect via
bluetooth to some GPS device and to
dump some gps NEMEA data.
For Nokia Serie 60 phones, pyfs have additional shell commands
See "man" pages.
contacts list access
simple webcam utility and screenshots
- say: speech
- play: Nokia audio
- info: Nokia device
- On the Nokia with pyS60 (Python for Nokia phones) you must
install "server.py" and "client.py" as python scripts, and
every other *.py as python module. As
alternative, you can
put everything in the E:\system\apps\pyfs directory. NEW: starting from v0r3,
I've provided a Symbian SYS
installer. (see the download directory)
- On the XBOX: you must install every *.py in the
- On Linux and WinXP, simply unpack the ZIP of TGZ in a
directory (es: c:\pyfs) and run server.py (or client.py) from it.
Command-line options: server.py
Basically, the server can start in two modes: the BT (bluetooth mode), and
the TCP mode. The server needs an additional parameter: the port. If mode=TCP, the port
is the usual TCP/IP port (default used in pyfs: 1025). If mode=BT, the
port is the bluetooth channel (default used py pyfs: 13)
# server.py (default options)
# server.py port
# server.py BT|TCP port
Without paramenters, server.py
do a sort of autodetection: it starts in BT mode (channel 13) if you
starts it on the cell phone; TCP mode in the other cases.
Command-line options: client.py
The synopsis for client.py :
# client.py address
client.py 00:16:4E:D3:75:55 13 (BT mode)
client.py xbox 1025 (TCP mode)
For this little project I used code and suggestions from
a lot of people over Internet. Thanks to the
Authors of pyshell, putools, and to the Authors of
several good python tutorials I found, such mobilenin and the developers of the
Python Symbian porting. You can find these materials by using google.
Sorry, I don't remember the URLs.
Thanks to Sunsite.dk to host again a project of
The code is released as is, without
any kind or warranties.
The code is released under the GPL license.
Sorry for the fractured english used here and in the coding.
For suggestions about improvement please contact:
Andreoli michele.andreoli (at) katamail.com