Comments (8)
I completely agree and has been something that has bothered me for a while as well. There are however some compatibility issues across the OS's (Windows specifically). I'll look into providing the use of config as an option but it almost certainly won't be enabled by default.
from sftpretty.
I can't speak for all versions of Windows, but up to date versions of Windows 10, and 11, have OpenSSH built in, and the applications included in that suite will read from ~/.ssh/config
if it is available (%USERPROFILE%\.ssh\config
).
I'm no Python expert, but I believe something in import os
will expand ~ to the user's home directory on both OS types.
from sftpretty.
That is true but in my admittedly limited experience the linux sub-system is a completely seperate file-system and ~
doesn't default to the linux home location. I'm also not sure if the sub-system is enabled by default on all versions of 10 or 11 or if it is a toggle-able feature on some/all.
from sftpretty.
Just need to add some tests before merging.
from sftpretty.
The feature is ready and enabled by default. I've updated the documentation with the nitty gritty but just going to iterate some important notes. By default the current procedure checks a user's default home location ~/.ssh/config
but will not fail if it doesn't exist and simply sets a minimal config with no options. Trying to keep backwards compatibility in mind (those words make me cringe) I've tried to make the feature as transparent as possible when not being used while doing my best to mimic the traditional seemless config experience if you do. Currently config options take precedent over parameters but all this behavior is subject to change based on community feedback. Currently the biggest issue I forsee is the growing delta between supported security option algorithms in paramiko and a users SSH program (OpenSSH more than likely). Especially if a config is picked up without the user realizing it is being read.
from sftpretty.
Just tried out the new release, seems to work perfectly 👌
The only comment I have, is on your example in the README. You'll likely need to change config='~/.ssh/config'
to config=os.path.expanduser('~/.ssh/config')
, otherwise you'll get something like this:
Traceback (most recent call last):
File "/home/matthew/Documents/projects/vidup/main.py", line 20, in <module>
class Manager(QObject):
File "/home/matthew/Documents/projects/vidup/main.py", line 217, in Manager
cnopts = CnOpts(config='~/.ssh/config')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/matthew/Documents/projects/vidup/venv/lib/python3.11/site-packages/sftpretty/__init__.py", line 85, in __init__
self.ssh_config = self.ssh_config.from_path(config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/matthew/Documents/projects/vidup/venv/lib/python3.11/site-packages/paramiko/config.py", line 109, in from_path
with open(path) as flo:
^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '~/.ssh/config'
Now I just gotta find a clean way to stop transfers mid-upload(/download), but that's probably an issue for paramiko itself...
from sftpretty.
Wow for shame, an issue of recursion depth, been coding too much javascript lately it seems, tried to save a line and introduced this bug instead. I'm not sure if you mean resuming an download/upload when you say 'stop transfers' but I have PR #39 in the works with that feature.
from sftpretty.
Wow for shame, an issue of recursion depth, been coding too much javascript lately it seems, tried to save a line and introduced this bug instead. I'm not sure if you mean resuming an download/upload when you say 'stop transfers' but I have PR #39 in the works with that feature.
Not quite looking for resume. I'm using this library for a program that is used to upload large files (usually ~11 GB) to a Linux server, which is very slow - especially if someone made a mistake or changed their mind 😁 - my current solution is a hacking implementation of threading.Thread
that I can raise an exception in, and I run sftpretty in that cursed thread haha.
So I mean, my system works, but surely I can't be the only one who might want to, essentially, press Ctrl+C on that SFTP upload/download.
from sftpretty.
Related Issues (18)
- Typo in argument name - tires/tries HOT 2
- put_d() unexpected remote path handling and issue with absolute Windows paths HOT 9
- calling basicConfig at this level for a library that should be embedded changes all dowstream logs HOT 1
- Need less logging HOT 4
- Windows: No hostkey for host [localhost] found. HOT 16
- AttributeError: str object has no attribute root for put_d in localdir.root HOT 1
- Windows: No hostkey for host [localhost] found - Part 2 HOT 1
- Question: Is the put_d method expected to upload files to remote path with the same path as localpath? HOT 3
- Put_d has issue in creating remote directory HOT 1
- get_r copies remote folder structure into localdir HOT 3
- ChannelException while using get_r HOT 2
- Connection duplicated HOT 2
- Can't catch IOError when retry is enabled during uploading a file HOT 2
- Feature Request: able to set max workers for any ThreadPoolExecutor HOT 1
- sftpretty adding console log to root logger HOT 2
- when knowhosts directory doesn't exist. it will keep throwing FileNotFoundError regardless we set hostkeys=None HOT 3
- paramiko.ssh_exception.SSHException: No hostkey for host [] found. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sftpretty.