mar10 / pyftpsync

Synchronize directories using FTP(S), SFTP, or file system access.
https://pyftpsync.readthedocs.io
MIT License
117 stars 25 forks source link

python 3.5 types #9

Closed Nikovit closed 8 years ago

Nikovit commented 8 years ago

I use python 3.5, the error types

Traceback (most recent call last): File "/home/r1ka/backup.py/PostgreSQL_bacup2.py", line 58, in s = BiDirSynchronizer(local, remote, opts) File "/home/r1ka/backup.py/ftpsync/synchronizers.py", line 535, in init super(BiDirSynchronizer, self).init(local, remote, options) File "/home/r1ka/backup.py/ftpsync/synchronizers.py", line 66, in init remote.open() File "/home/r1ka/backup.py/ftpsync/ftp_target.py", line 88, in open self.ftp.connect(self.host, self.port) File "/usr/local/lib/python3.5/ftplib.py", line 146, in connect if port > 0: TypeError: unorderable types: str() > int()

mar10 commented 8 years ago

Could you try to replace

        if self.port:
            self.ftp.connect(self.host, self.port)
        else:
            self.ftp.connect(self.host)

with

        if self.port:
            self.ftp.connect(self.host, int(self.port))
        else:
            self.ftp.connect(self.host)

and let us know if it works (or even create a pull request)?

Nikovit commented 8 years ago

does not work:

Traceback (most recent call last): File "/home/r1ka/backup.py/PostgreSQL_bacup2.py", line 102, in s = BiDirSynchronizer(local, remote, opts) File "/home/r1ka/backup.py/ftpsync/synchronizers.py", line 535, in init super(BiDirSynchronizer, self).init(local, remote, options) File "/home/r1ka/backup.py/ftpsync/synchronizers.py", line 66, in init remote.open() File "/home/r1ka/backup.py/ftpsync/ftp_target.py", line 88, in open self.ftp.connect(self.host, int(self.port)) ValueError: invalid literal for int() with base 10: 'user'

mar10 commented 8 years ago

Seems you're passing "user" instead of a port Can you post your code?

Nikovit commented 8 years ago

I give an example of how to http://pyftpsync.readthedocs.io/en/latest/

My code: https://github.com/Nikovit/backup/blob/master/PostgreSQL_bacup2.py

mar10 commented 8 years ago

The signature is described here http://pyftpsync.readthedocs.io/en/latest/ftpsync.html#module-ftpsync.ftp_target but the tutorial was misleading: You were passing the username for the port.