Ninovolador added a comment.

  I think it's a little convoluted but after a while I managed to get it 
working for my specific purpose.
  
  So I ended up doing
  
    def _(old, new):
        bot.filename = new
    
    bot.post_processor = _
    bot.run()
    
    return bot.filename
  
  inside my upload helper function. It was a little counter-intuitive and 
tricky because I needed to retrieve the file name out of that function that I 
can't get the `return` value directly, and `global` variables are ugly, so I 
ended up attaching it to the bot anyway.
  
  I'm not uploading anything today or in the near future, but I did a couple of 
tests, and it worked (I got the new filename after uploading it)
  
  Thanks!
  
  PS: I'm going to leave the code as it is, but I was reading into the code and 
thinking: shouldn't  it have a dictionary of `file_url: filename` pairs, 
something like  `self.counter`? That would be an straighter way of getting that 
info

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

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

To: Xqt, Ninovolador
Cc: Xqt, Aklapper, pywikibot-bugs-list, Ninovolador, mevo, Isabelladantes1983, 
Themindcoder, Adamm71, Jersione, Hellket777, LisafBia6531, 786, Biggs657, 
PotsdamLamb, Jyoo1011, JohnsonLee01, Juan90264, SHEKH, Dijkstra, Alter-paule, 
Beast1978, Un1tY, Khutuck, Zkhalido, Hook696, Kent7301, joker88john, Viztor, 
CucyNoiD, Wenyi, Gaboe420, Giuliamocci, Cpaulf30, Af420, Bsandipan, Tbscho, 
MayS, Lewizho99, Mdupont, JJMC89, Maathavan, Dvorapa, Altostratus, Neuronton, 
Avicennasis, mys_721tx, jayvdb, Masti, Alchimista
_______________________________________________
pywikibot-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to