LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-25-2013, 06:43 AM   #1
exelman
LQ Newbie
 
Registered: Jun 2012
Location: belgium
Distribution: DSL
Posts: 12

Rep: Reputation: Disabled
Arrow access ubuntu.one in ftp on DSL4.4.10


Hello

I work with dsl 4.4.10, which is Debian Woody based.
To have ftp access to Ubuntu.one, they provide a package called u1ftp-0.1.zip on there site. To use it, one need to have at least Python2.4.
So I installed Python2.4.1 from the Debian Sarge repo.
When I want to start connection, I have the following output;

Quote:
sys:1: DeprecationWarning: Non-ASCII character '\x9f' in file u1ftp-0.1.zip on line 2, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
File "u1ftp-0.1.zip", line 1
PK_PTEhA£EĀ
^
SyntaxError: invalid syntax
So , I went to the site mentioned, and put
Code:
"#coding=latin-1"
on top of all the files, and that gives this output;

Quote:
File "/mnt/hdb1/home2-n13/u1ftp/u1ftp-changed.zip", line 1
PK
^
SyntaxError: invalid syntax
I know that with Python2.6 it works, but to install Python2.6 I'm afraid I'm going to de-stabilise my kernel, and it is a whole bunch of packages to install.
So, what I wanted to know is, if there is no solution with these current settings?

Thanks.
 
Old 12-25-2013, 06:56 AM   #2
snowday
Senior Member
 
Registered: Feb 2009
Posts: 4,667

Rep: Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411
Have you considered simply upgrading to a supported distro? (Debian Woody has been "end of life" since 2006 so you are missing seven years of security patches and bug fixes!!)
 
Old 12-27-2013, 08:15 AM   #3
exelman
LQ Newbie
 
Registered: Jun 2012
Location: belgium
Distribution: DSL
Posts: 12

Original Poster
Rep: Reputation: Disabled
Arrow which coding

If someone can tell me, what is the encoding in the following files, maybe I can manage.
#!/usr/bin/python etc... I had added myself.

Quote:
#!/usr/bin/python
#coding: latin-1
import os, sys

from twisted.internet import reactor
from twisted.protocols import ftp

from u1ftp.portal import make_portal


def main(argv):
portal = make_portal(
reactor,
base_url='https://one.ubuntu.com/api/file_storage/v1',
content_base_url='https://files.one.ubuntu.com',
sso_base_url='https://login.ubuntu.com/api/1.0/',
sso_ping_url='https://one.ubuntu.com/oauth/sso-finished-so-get-tokens/')
server = ftp.FTPFactory(portal)
reactor.listenTCP(2121, server, interface='127.0.0.1')
print 'Listening on ftp://127.0.0.1:2121/'
reactor.run()


sys.exit(main(sys.argv))


Quote:
# this is a namespace package
try:
import pkg_resources
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)

Quote:
"""
escape/unescape routines available for backends which need
alphanumeric usernames, services, or other values
"""

import string
import re
import sys

LEGAL_CHARS = (
getattr(string, 'letters', None) # Python 2
or getattr(string, 'ascii_letters') # Python 3
) + string.digits

ESCAPE_FMT = "_%02X"

def _escape_char(c):
"Single char escape. Return the char, escaped if not already legal"
if isinstance(c, int):
c = unichr(c)
return c if c in LEGAL_CHARS else ESCAPE_FMT % ord(c)

def escape(value):
"""
Escapes given string so the result consists of alphanumeric chars and
underscore only.
"""
return "".join(_escape_char(c) for c in value.encode('utf-8'))

def _unescape_code(regex_match):
ordinal = int(regex_match.group('code'), 16)
if sys.version_info >= (3,):
return bytes([ordinal])
return chr(ordinal)

def unescape(value):
"""
Inverse of escape.
"""
re_esc = re.compile(
# the pattern must be bytes to operate on bytes
ESCAPE_FMT.replace('%02X', '(?P<code>[0-9A-F]{2})').encode('ascii')
)
return re_esc.sub(_unescape_code, value.encode('ascii')).decode('utf-8')

Last edited by exelman; 12-27-2013 at 08:18 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ftp(through web site access to ftp server) kelper Linux - Software 4 07-03-2015 05:14 PM
FTP user access on Ubuntu noob_J Linux - Newbie 2 07-05-2010 05:08 PM
Access to one server via root/ssh/ftp on other only ftp anthonychallis Linux - Newbie 4 01-12-2010 02:23 PM
Belkin F5D5020 16 bit PCMCIA network adapter not working under DSL4.4.10, any ideas? soldersplash DamnSmallLinux 8 10-23-2009 04:57 AM
FTP/SFTP write access denied on Ubuntu Server prudens Linux - Newbie 1 07-18-2009 10:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration