Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
file doesn't exist
#31
well, than is a mystery why it still doesn't work, lol !
Reply
#32
how do you run them? show the full output from both server and client terminal. Maybe even a screenshot of both
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#33
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
Reply
#34
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
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#35
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
Reply
#36
you can change it to download to whatever folder you want - just fix the path in the client script
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#37
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 ?
Reply
#38
actually it overwrites the previous one with the same name, you can change the file between 2 runs to check for yourself
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#39
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 ?
Reply
#40
filename = 'something.png'
to replace

filename = input("enter file name ->")
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  HTML file uploaded through python screen doesn't look as expected miker2808 6 5,154 Aug-04-2018, 02:05 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020