Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically replacing files when downloading - yes this is behaviour of downloading #265

Closed
iCreamble opened this issue Jun 6, 2021 · 3 comments
Labels

Comments

@iCreamble
Copy link

It might be something wrong with my code, but the problem is:
My automation process includes clicking on a button that downloads a file. This file, often, has the same name, so when I do it manually the file is downloaded as file.pdf, file(2).pdf, file(3).pdf and so on...
When I made the automation process, two things changed:

  1. The download path is no longer the "DOWNLOADS" folder, but the script.py path;
  2. The downloads keep replacing each other, always with file.pdf name, so I cant have multiple files with the same name

The automation process simply includes the click on the button:
r.click('//*[@id="print-button"]')

Is it normal? Can it be changed?

Thanks!

@kensoh
Copy link
Member

kensoh commented Jun 8, 2021

Hi @iCreamble! I confirm that these 2 actions are the behaviour for the upstream TagUI project.

There is an open issue there to make it easier to change the download folder - aisingapore/TagUI#1035

But in the meantime, it will be using this line of code to specify download location - #210 (comment)

For overwriting the same file, I don't know how to change this behaviour and not found anything from googling. If you find something you can share with me. Alternatively, every time you download something, you can rename the file to some other filename using Python os.rename - https://www.tutorialspoint.com/python/os_rename.htm

@kensoh kensoh changed the title automatically replacing files when downloading Automatically replacing files when downloading - yes this is behaviour of downloading files Jun 8, 2021
@kensoh kensoh added the query label Jun 8, 2021
@kensoh kensoh changed the title Automatically replacing files when downloading - yes this is behaviour of downloading files Automatically replacing files when downloading - yes this is behaviour of downloading Jun 8, 2021
@kensoh
Copy link
Member

kensoh commented Jun 8, 2021

Adding on, there is r.download() which you can try out to see if that works for you. That can specify download location.

@iCreamble
Copy link
Author

Your suggestions worked! Thanks. I did not find a way to modify the replacement problem, but the os.rename worked fine.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants