Ninovolador added a comment.

  In T360837#9676200 <https://phabricator.wikimedia.org/T360837#9676200>, @Xqt 
wrote:
  
  > Both `UploadRobot.process_filename()` and `UploadRobot.upload()` already 
gives the filename back to the calling process (which is `UploadRobot.run()` by 
default. I've no glue for what the `last_filename` attribute is good for. Could 
you pleas explain a bit more.
  
  I'm no coder. `last_filename` was a crappy attempt to be able to get the 
final filename after `.process_filename()` finishes.
  
  I'll try to explain once again what I'm trying to achieve. This is my test 
code
  
    import os
    from pywikibot.specialbots import UploadRobot
    from pywikibot import Site
    Commons = Site('commons', 'commons')
    
    filename = 'Catálogo de libros escogidos - bdh0000197468.pdf'
    filepath = os.path.join(os.getcwd() + '\\PDF', filename)
    
    bot = UploadRobot(filepath, description='DESCRIPTION', 
use_filename=filename,
                      chunk_size=1000000, verify_description=True,
                      target_site=Commons)
    x = bot.run()
    
    lista = [(key, bot.__dict__[key]) for key in bot.__dict__.keys()]
    print(lista)
  
  
  
  - I follow the guidelines and setup a new instance of `UploadRobot` with a 
`filename` I may or may not give it beforehand.
  - Then call `UploadRobot.run()`and use the interactive command line upload 
interface. Inside said interface, I change the `filename` and upload the file 
to Commons under a new `filename`.
  - Then I want to use the new  `filename` in other way, such as creating a 
list of files I've uploaded, or linking the file back to an article:
    - `UploadRobot.run()` returns `None`.
    - The `UploadRobot` dict of propierties shows that the only `filename` is 
"stored" at `.use_filename`  but it's the "old" filename.

TASK DETAIL
  https://phabricator.wikimedia.org/T360837

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Ninovolador
Cc: Xqt, Aklapper, pywikibot-bugs-list, Ninovolador, mevo, PotsdamLamb, 
Jyoo1011, JohnsonLee01, SHEKH, Dijkstra, Khutuck, Zkhalido, Viztor, Wenyi, 
Tbscho, MayS, Mdupont, JJMC89, Dvorapa, Altostratus, Avicennasis, mys_721tx, 
jayvdb, Masti, Alchimista
_______________________________________________
pywikibot-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to