Python Forum
file doesn't exist - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Networking (https://python-forum.io/forum-12.html)
+--- Thread: file doesn't exist (/thread-21991.html)

Pages: 1 2 3 4


RE: file doesn't exist - mcgrim - Oct-24-2019

well, than is a mystery why it still doesn't work, lol !


RE: file doesn't exist - buran - Oct-24-2019

how do you run them? show the full output from both server and client terminal. Maybe even a screenshot of both


RE: file doesn't exist - mcgrim - Oct-24-2019

I am running them on pycharm, I just click on 'run'
I start with the server first

Output:
C:\Users\PycharmProjects\client-server\venv\Scripts\python.exe C:/Users/PycharmProjects/client-server/server_2.py server started... client connected ip>:('127.0.0.1', 61017)
Output:
C:\Users\PycharmProjects\client-server\venv\Scripts\python.exe C:/Users/PycharmProjects/client-server/client_2.py enter file name ->upper.txt this file exists 18bytes, download(Y/N)?y Process finished with exit code 0



RE: file doesn't exist - buran - Oct-24-2019

well, look at this line
this file exists 18bytes, download(Y/N)?y

here you enter small y while the code expects capital Y

you can change
if message == 'Y':
to
if message.lower() == 'y':
this way it will work for both lower and upper case Y


RE: file doesn't exist - mcgrim - Oct-24-2019

nevermind, the mistake was very silly.
It is supposed to be Y and not y.
Now is downloading it, but in the same folder as the previous one


RE: file doesn't exist - buran - Oct-24-2019

you can change it to download to whatever folder you want - just fix the path in the client script


RE: file doesn't exist - mcgrim - Oct-24-2019

I have a question: it downloads it only once.
If I run the client multiple times, it doesn't download
anymore duplicates.
Is it normal ?


RE: file doesn't exist - buran - Oct-24-2019

actually it overwrites the previous one with the same name, you can change the file between 2 runs to check for yourself


RE: file doesn't exist - mcgrim - Oct-24-2019

If one wants to change the client code and eliminate the dialogue box, and write the file directly,
how would you implement it?
just by writing
filename = open("something.png", wb)
instead of the input command, gives you an error.
how come ?


RE: file doesn't exist - buran - Oct-24-2019

filename = 'something.png'
to replace

filename = input("enter file name ->")