mafalb / python-ftputil Goto Github PK
View Code? Open in Web Editor NEWOnly a slightly modified version, see the README or http://ftputil.sschwarzer.net/trac
Home Page: http://github.com/mafalb/python-ftputil/wiki/python-ftputil
License: Other
Only a slightly modified version, see the README or http://ftputil.sschwarzer.net/trac
Home Page: http://github.com/mafalb/python-ftputil/wiki/python-ftputil
License: Other
I have a FTP server that is 4 hours ahead of my client. I was hoping to get correct time by setting time_shift in the host object. After checking the code for function parse_unix_time, the time_shift is not applied to the time object created from ftp response lines. Since the response line returns the FTP server time, without applying the time_shift will end up giving wrong local time.
Suggest correction:
```
if ":" not in year_or_time:
# `year_or_time` is really a year
year, hour, minute = int(year_or_time), 0, 0
st_mtime = time.mktime( (year, month, day,
hour, minute, 0, 0, 0, -1) )
**st_mtime += time_shift**
# Precise up to a day
st_mtime_precision = 24 * 60 * 60
else:
# `year_or_time` is a time hh:mm
hour, minute = year_or_time.split(':')
year, hour, minute = None, int(hour), int(minute)
# Try the current year
year = time.localtime()[0]
st_mtime = time.mktime( (year, month, day,
hour, minute, 0, 0, 0, -1) )
**st_mtime += time_shift**
# Precise up to a minute
st_mtime_precision = 60
Got below error while using isfile function of remote ftp box.
ftp_connect.path.isfile('Remotefile')
File "/tmp/ftpclass-1.py", line 30, in
fetch()
File "/tmp/ftpclass-1.py", line 25, in fetch
source = ftp_connect.path.isfile('Remote-file.txt')
File "/app/Python-2.7.5/lib/python2.7/site-packages/ftputil/path.py", line 138, in isfile
path, _exception_for_missing_path=False)
File "/app/Python-2.7.5/lib/python2.7/site-packages/ftputil/host.py", line 846, in stat
return self._stat._stat(path, _exception_for_missing_path)
File "/app/Python-2.7.5/lib/python2.7/site-packages/ftputil/stat.py", line 735, in _stat
_exception_for_missing_path)
File "/app/Python-2.7.5/lib/python2.7/site-packages/ftputil/stat.py", line 699, in __call_with_parser_retry
return method(_args, *_kwargs)
File "/app/Python-2.7.5/lib/python2.7/site-packages/ftputil/stat.py", line 656, in _real_stat
lstat_result = self._real_lstat(path, _exception_for_missing_path)
File "/app/Python-2.7.5/lib/python2.7/site-packages/ftputil/stat.py", line 615, in _real_lstat
for stat_result in self._stat_results_from_dir(dirname):
File "/app/Python-2.7.5/lib/python2.7/site-packages/ftputil/stat.py", line 546, in _stat_results_from_dir
self.host.time_shift())
File "/app/Python-2.7.5/lib/python2.7/site-packages/ftputil/stat.py", line 478, in parse_line
st_mtime = self.parse_ms_time(date, time, time_shift)
File "/app/Python-2.7.5/lib/python2.7/site-packages/ftputil/stat.py", line 316, in parse_ms_time
for part in date.split("-")]
File "/app/Python-2.7.5/lib/python2.7/site-packages/ftputil/stat.py", line 171, in _as_int
int_string))
ftputil.error.ParserError: non-integer year/month/day value u'drwxr'
Same code works when date on remote is not 29-Feb-2016 which is a leap year.
Python 2.7.5 and ftputil (3.2)
When running :
ftp_host = ftputil.FTPHost(host, usr, psw)
recursive = ftp_host.walk(path, topdown=True, onerror=None)
for root, dirs, files in recursive:
do something...
ftputil returns the error above when running the iteration over the generator called 'recursive'. I am stuck with this issue.
Is this a bug?
Is it possible to send commands to ftp server? I need to send "REST bytes_offsets" command to server, so that when I call ftputil.FTPHost's "download" method, it starts to download that files from bytes_offsets.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.