Bugs item #1769869, was opened at 2007-08-08 11:11
Message generated for change (Comment added) made by wikipedian
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=176986…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: other
Group: None
Status: Closed
Resolution: Fixed
Priority: 5
Private: No
Submitted By: Filnik (filnik)
Assigned to: Nobody/Anonymous (nobody)
Summary: replace.py has problem with "\n"
Initial Comment:
I have tried with:
replace.py -regex -cat:Dipinti_di_Kandinsky "\[\[[Cc]ategoria:[Dd]ipinti[ _]di[
_][Kk]andinsky\]\]" "[[Categoria:Dipinti di Kandinsky]]\n[[Categoria:Dipinti
astratti]]" -summary:"Bot: Aggiungo categoria"
but the "\n" isn't converted into a new line... Bryan and valhallasw has
said that it should work but it doesn't... can anyone check if the \n is converted
properly? Thanx, Filnik
----------------------------------------------------------------------
Comment By: Daniel Herding (wikipedian)
Date:
2007-09-20 22:25
Message:
Logged In: YES
user_id=880694
Originator: NO
This should be fixed. You can now use \n inside the replacement when
you're using Windows.
Note that this isn't a fix for a PyWikipediaBot bug, but a workaround for
a Windows problem.
----------------------------------------------------------------------
Comment By: Falk Steinhauer (falk_steinhauer)
Date: 2007-08-08 23:08
Message:
Logged In: YES
user_id=1810075
Originator: NO
As I know, the windows console isn't able to take special characters like
newline or backslash as arguments.
So every time I need one of those characters, I enter them manually in
function doReplacements() of module replace.py.
For instance:
def doReplacements(self, original_text):
"""
Returns the text which is generated by applying all replacements
to the
given text.
"""
new_text = original_text
# dirty trick for special characters:
self.replacements = []
self.replacements.append( ('RegExp','Replacement') )
for old, new in self.replacements:
new_text = wikipedia.replaceExcept(new_text, old, new,
['nowiki', 'comment', 'math', 'pre'], allowoverlap =
self.allowoverlap)
return new_text
Because this works, it cannot be a bug in replace.py.
----------------------------------------------------------------------
Comment By: Aurimas Fischer (ebola_rulez)
Date: 2007-08-08 13:10
Message:
Logged In: YES
user_id=959303
Originator: NO
It worked before, I used this several months ago (from my fixes.py):
(u'\{\{Taxobox_pradžia ?\|
?(.*?)}}(\r\n|\n)(\{\{Taxobox_begin_placement)', ur'{{Taxobox_pradžia |
\1}}\n{{Taxobox_paveiksliukas | image = | caption = }}\2\3')
And now it doesn't
----------------------------------------------------------------------
Comment By: Daniel Herding (wikipedian)
Date: 2007-08-08 12:22
Message:
Logged In: YES
user_id=880694
Originator: NO
In Linux, it is possible to just press enter to create a newline, as long
as the string is inside quoataion marks.
-----------------------
daniel@localhost:~/projekte/pywikipedia> python replace.py mp "m
p" -page:Wikipedia:Spielwiese
Checked for
running processes. 1 processes currently running, including
the current process.
Getting 1 pages from wikipedia:de...
>> Wikipedia:Spielwiese <<<
-
Example
+ Exam
+ ple
Do you want to accept these changes? ([y]es, [N]o, [a]ll)
-----------------------
I don't know if that's possible in Windows. At least in the replacement
part, you cannot use the \n even in Linux.
----------------------------------------------------------------------
Comment By: Filnik (filnik)
Date: 2007-08-08 11:24
Message:
Logged In: YES
user_id=1834469
Originator: YES
It doesn't work :'( see:
http://it.wikipedia.org/w/index.php?title=Composizione_%28Kandinsky_1916%29…
----------------------------------------------------------------------
Comment By: Aurimas Fischer (ebola_rulez)
Date: 2007-08-08 11:19
Message:
Logged In: YES
user_id=959303
Originator: NO
Try using \r\n for newline
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=176986…