Click here to Skip to main content
15,942,710 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello.I have a python code(name: test.py).
I run a loop printing a value every 1 sec. and when the value reach number '5', then I want to download a python file (name: test.py) from my github.
The filename that just downloaded is test.py.1
The code for test.py.1 is the same as the previous one(1st test.py program) except that the number now is not '5' ,but '20' ,because I want 20 sec. in order to upload another file on github, so that test.py.1 code download it when value reach number '20' as I said before.
The filename that just downloaded is test.py.2
So,the problem is that when I download the file test.py.2 the code is not the one Ι uploaded, but is the same as test.py.1 (test.py.2 is the same as test.py.1)
Here, are the 3 programs:

What I have tried:

Program #1 (test.py)

Python
import os , time , sys
i = 1
while(1):
    if(i == 5):
        os.system("wget 'https://github.com/NickGkoutzas/autoClicker/raw/main/test.py'")
        time.sleep(2)
        os.system("python3 test.py.1")
    else:
        print(str(i))
        time.sleep(1)
        i += 1




Program #2 (test.py.1)
Python
import os , time , sys
i = 1
while(1):
    if(i == 20):
        os.system("wget 'https://github.com/NickGkoutzas/autoClicker/raw/main/test.py'")
        time.sleep(2)
        os.system("python3 test.py.2")
    else:
        print("helloooooo " + str(i))
        time.sleep(1)
        i += 1



Program #3 (test.py.2)
Python
import os , sys , time
i=1
while(1):
    print("KKKKKKKKKKKKKKKKKKK  -> " + str(i))
    time.sleep(1)
    i += 1



What is the problem?
Posted
Updated 24-Oct-22 5:27am
v2
Comments
Richard MacCutchan 24-Oct-22 11:52am    
"What is the problem?"
Impossible to say without access to your github repository. Or maybe you could do some debugging to see for yourself.
Nick_is_asking 24-Oct-22 11:55am    
Just change the link, put your github repository.......
Richard MacCutchan 24-Oct-22 11:56am    
I don't have a github repository, and have no intention of creating one.
Nick_is_asking 24-Oct-22 11:59am    
Ok,never mind,but thank you for your time
Richard MacCutchan 24-Oct-22 12:02pm    
OK, I just tried the download from github and it gets test.py.2. So I can only assume it is a timing issue between your running code and the upload.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900