Python Forum

Full Version: file doesn't exist
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
well, than is a mystery why it still doesn't work, lol !
how do you run them? show the full output from both server and client terminal. Maybe even a screenshot of both
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
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
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
you can change it to download to whatever folder you want - just fix the path in the client script
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 ?
actually it overwrites the previous one with the same name, you can change the file between 2 runs to check for yourself
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 ?
filename = 'something.png'
to replace

filename = input("enter file name ->")
Pages: 1 2 3 4