r/Python • u/RainingComputers • May 31 '18
I made a FTP/SFTP client using python and tkinter
126
May 31 '18
Have you made the icons yourself ? They're really neat
67
56
u/gschizas Pythonista May 31 '18 edited Jun 01 '18
Dependencies
Installing dependencies is more standard to be done with exporting your dependencies into a requirements.txt file, or even better, the new standard, a Pipfile, used with pipenv.
Old way (requirements.txt)
Go to the folder of your project
Create a file
requirements.txtwith these contents:
paramiko>=2.4.1
psutil>=5.4.5
pywin32>=223Run (or tell the user to run)
pip install -r requirements.txt
Notes:
I'm not sure how to have two separate
requirements.txtfor Windows and non-WindowsDon't use pypiwin32, pywin32 is in the Python Package index now, and it works fine (-ish). pypiwin32 is considered obsolete.
New way (pipenv/Pipfile)
Go to the folder of your project
Run
pipenv install paramiko psutil pypiwin32This will take a while and will create the following
Pipfile:
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
paramiko = "*"
psutil = "*"
"pywin32" = "*"
[dev-packages]
[requires]
python_version = "3.6"Edit that file and change the "pywin32" line to last line to read:
"pywin32" = {version = "*", sys_platform = "== 'win32'"}There's probably an easier way to specify system platofrm for
pywin32than editing that file, but I haven't been able to find it.After all of the above steps are done, you can run
pipenv shelland it will open a new shell (bash/zsh/powershell/cmd/whatever) with just those libraries inside a virtual environment, so you (a) don't have to run this as an administrator to install the libraries (b) you don't "contaminate" your system with all those (possibly conflicting) libraries (c) you don't forget about the libraries that are really required.
Miscellaneous notes
Usually the executable isn't named
Source.py, but__main__.py. This way you can run your program by runningpython whipFTP(your current directory must be one level up from the directory of your program).main.pyandwhipFTP.pyare also acceptableDon't upload built zip files with the build to github. You should upload the final executables as releases
I don't get what exactly you've done with the
libtkdnd2.8.dllfile - it doesn't work for me at allThe windows zip file also contains linux
*.sofiles, and the linux zip file also contains*.dllfiles. You shouldn't put more files than necessary to the platform-specific filesDid you know that you can run a zip file as if it was a Python package? It needs a bit of setup (a
__main__.pyfile is required, IIRC), but it's worth it.Tk is supposed to come with Python, at least in Windows. You shouldn't be needing to include it.
EDIT: Formatting
17
u/RainingComputers Jun 01 '18
OMG thanks a lot for the feedback. I will be sure to go through this and make necessary changes.
1
u/mbarkhau Jun 01 '18
Also take a look at ssh2-python as a replacement for paramiko, I think it's faster.
4
u/RainingComputers Jun 01 '18
Hmmm...I am not sure about replacing paramiko (I will have to rewrite and test a lot of code) but I will keep this in mind for future versions.
3
1
u/AnAngryFredHampton Jun 01 '18
Hey guy. Is there a way to use the new pipfile format, but just install things like normal (no virtual environment)? I can't find anything online, just people who want to use their old requirements.txt with pipenv.
1
u/gschizas Pythonista Jun 01 '18
Well, you shouldn't be "installing things like normal" in any case! This is not "normal", it's the not recommended way to do stuff!
To answer your question, the whole point of Pipenv is to facilitate your workflow so that you can easily work with virtual environments (and extensions etc.). I guess you could make the pipenv generate a requirements.txt from the Pipfile (do a `pipenv lock -r) and use that for pip, but it's really convoluted and weird.
Just use virtual environments! Life will be much easier and more organized with them.
I get that you're worried that you'll have one more thing to worry about etc, but that's what pipenv is here to help you with!
Here's your old workflow
Run
sudo pip install library_xon Linux/macOS/BSD, or start an elevated PowerShell/Command Prompt on Windows and dopip install library_xStart Python and use library_x
Here's your new workflow:
pipenv install library_x(no sudo, no elevation)
pipenv shellRun Python and use your library.
Yes, it does seem like a step more, but it swallows the "sudo/elevated" stuff you need to do to install the "library_x" into your system. And of course, installing stuff in your system Python in Linux can go downhill fast.
25
u/randiaz1995 May 31 '18
Holy smokes, that is brilliant! Just saw the github page and how it is not available for mac, looks better than Cyberduck for Mac... I am willing to help develop it for Mac os.
5
u/RainingComputers Jun 01 '18
I think it already can run on a Mac, but testing is required.
Edit: Might also require minor changes to code. I will setup a Mac VM and see what I can do.
7
4
u/ShewanellaGopheri May 31 '18
Not smart enough to help but I would 100% use this over filezilla for Mac
13
May 31 '18
Supports Putty key pair?
28
u/RainingComputers May 31 '18
I don't know what a Putty key pair is, so I am afraid it does not. I will look it up...
28
May 31 '18
More generally I should say SSH (public-private) key pair. I see you are using Paramiko for SSH, which supports key pair. Maybe only thing required is pre setting key in home dir or option to import and specify it.
Edit: about Paramiko
13
u/RainingComputers May 31 '18
I might add it in the next version.
5
May 31 '18
Did a sluggish Ninja edit.
13
u/RainingComputers May 31 '18
Ok. I think I need to add a settings button that lets you choose were all the keys are stored.... Edit: Thanks for telling me this.
7
u/Jonno_FTW hisss Jun 01 '18
Don't forget to read ~/.ssh/config so you can automatically apply the correct key based off the rules in there.
4
u/the_kindly_one May 31 '18
Add connection via scp and you'll have another user. There is no current gui client that let's you transfer files via scp on Linux.
5
1
1
u/crunk Jun 01 '18
Are you sure ? You can connect using nautilus, using sftp:/// urls. I think most things that support sftp will work ?
1
u/the_kindly_one Jun 01 '18
Not when SFTP isn't supported at the other end. SOC device. Only vanilla ssh and therefore vanilla scp.
3
u/ninelives_dub Jun 01 '18
As a complete noob.. what exactly is this?
4
u/RainingComputers Jun 01 '18
You know you can run a web server and access the website using a browser like Chrome/Firefox? It is the same thing. You can run a FTP/SFTP server and access all your files using a FTP/SFTP client.
2
1
u/jpizzz Jun 01 '18
As an even bigger noob, what is an FTP/SFTP server?
1
u/willm Jun 01 '18
File Transfer Protocol / Secure File Transfer Protocol
Protocols for working with files / directories over the internet.
3
Jun 01 '18
Why did you choose tkinter as gui framework? I have a small project in mind which needs a gui framework, for context.
2
u/RainingComputers Jun 01 '18 edited Jun 01 '18
Tkinter comes with python and is very easy to use. Also this is the only GUI framework I know. I am planning to explore pyGTK or wxpython.
Edit: I think pyGTK has the advantage of looking more native but has a more steeper learning curve compared to tkinter. Also tkinter does require workarounds to make it look nice (take a look at the source code for this project).
Edit2: I do recommend using tkinter for your first GUI project.
2
1
3
u/game_ova Jun 01 '18
Hey was looking through your comments. There's a lot of instances where you write "weather" when you mean "whether"
2
2
u/auiotour May 31 '18
Didn't see it asked but does it have ability to sync ftp directories to local and keep checking. I am using winscp but crashes too often.
1
u/RainingComputers Jun 01 '18
By 'sync' do you mean check time stamps of each file and use the file with the latest time stamp?
1
u/auiotour Jun 10 '18
Sorry took so long. So lots of ways to actually handle it, however what I am looking for specifically would be ability to sync an ftp directory to a local directory. Checking either timestamp, or checksum. Options should include frequency, and whether to delete the file after transfer, or backing up the file after transfer. Also could add whether to transfer to remote, or local, or both. Ability to preview changes, and how to compare.
3
u/SummerSideReddit May 31 '18
Very nice GUI.
on another note, MANY people are using the latest Anaconda distribution which is on python 3.6.4. so asking 3.6.5 as minimum requirement could be problematic if you want a larger audience! well done!
5
u/RainingComputers May 31 '18
I think it may run on python 3.6.4. I will test it and change the requirements.
1
39
u/_TheC0NTR0L_ May 31 '18
That is really cool. Python is becoming more and more widely used for everything.
6
6
u/jokoon May 31 '18
What did you use for SFTP? What kind of crypto stuff?
A feature I love about filezilla is the comparison feature... I don't know if it would be hard to build into your client.
5
1
1
u/Eryole Jun 01 '18
1
u/RainingComputers Jun 01 '18
I am thinking of creating a 'Setup.exe' (win32 c++ app) that just downloads files from Github and automatically install python. This is a future project that I am planning to do. I have tried cx_Freeze and py2exe, both did not work properly. I have never tried nuitka though...I will give that a try....
1
1
u/throwthegit Jun 02 '18
Have you considered making this into a sellable product but keeping the source available?
1
u/RainingComputers Jun 02 '18
It still needs lot more features to be added to make it into a sellable product, but I want to keep this free anyways. I would like to accept donations but only after I think it has enough features. The source will ALWAYS be available.
1
u/Beneey Jul 28 '18
Hi Raining i trying to use the app look at what am getting:
File ".\whipFTP.py", line 1190, in <module>
root.tk.eval('package require tkdnd')
and this too
tkinter.TclError: couldn't load library "C:\Users\Benjamin\whipftp_4.1_windows\whipftp_4.1\TkDND/libtkdn
d2.8.dll": Bad exe format. Possibly a 32/64-bit mismatch.
Please any thought. Thanks
1
1
u/RainingComputers Jul 28 '18
Which python version?
1
u/Beneey Jul 28 '18
Python3.7
1
u/RainingComputers Jul 29 '18
Please try to get the source using git clone comand and try to run that. It may work.
1
u/RainingComputers Jul 29 '18
I will release the next version. I need to create a separate 64bit version. Thanks for pointing out.
1
u/RainingComputers Jul 29 '18
I created a 64bit version, you can download it from the releases page. Please tell me.if it works.
1
3
u/Dokiace May 31 '18
how do you make tkinter looks so good? I tried one back then and the gui is really bad/hard to make it good
1
May 31 '18
Wowww! Cool 8D very nice work!!! Could you recommend a good reference for tkinter??
5
u/RainingComputers May 31 '18
https://tkdocs.com http://effbot.org/tkinterbook/ and stackoverflow of course.
2
May 31 '18
Thanks! Will add them to the archive. In the process of gifting all my command-line tools gui's just because. Again, really awesome work- was actually working on an ssh server, and this will help a lot. hat tip
2
2
2
1
1
1
1
1
1
1
u/simcup Jun 01 '18
Now traumatized for life, marrying network to tkinter is ptsd inducing stuff oft nightmares. Congratz you keep enough sanity to use reddit
0
-1
May 31 '18
Aside from debian based OS and windows, how do you test it on freebsd and other linux distros? using vm?
8
u/RainingComputers May 31 '18
Yes.....also it is a python script, if you have a desktop environment and python installed on any UNIX system it should work.
-18
104
u/RainingComputers May 31 '18
Github link: https://github.com/RainingComputers/whipFTP