Hi folks,
is there a piece of code in pywiki that determines easily if the current time zone is summer or winter time? (Last Sunday of March, 3 o'clock -- last Sunday of October, 2 o'clock)
On 22 December 2012 09:37, Bináris wikiposta@gmail.com wrote:
is there a piece of code in pywiki that determines easily if the current time zone is summer or winter time? (Last Sunday of March, 3 o'clock -- last Sunday of October, 2 o'clock)
In the EU, yes. In the rest of the world, not so much (the US uses different dates and the southern hemisphere obviously has DST in the /other/ part of the year).
Depending on your actual question (why would you want to know when it's summer time or not? You probably want to convert times from the current timezone to UTC, or something ilike that)), you can try one of the following:
pytz.timezone('Europe/Amsterdam').utcoffset(datetime.datetime.now())
or, if you're interested in the timezone offset on the current machine:
time.timezone
(which is 3600 or 7200 for Europe/Amsterdam)
Merlijn
Thank you! I was not clear enough, I wrote these concrete dates because the bot would be huwiki-specific.
Hello guys, I am novice pywikipedia framework user. I am using it on windows platform and i want to run my bot on Gujarati Wikipedia. Using Command Prompt, i am not able to pass arguments in Gujarati language. Is there any way out??
-- Samkit
Hi Samkit,
On 25 December 2012 08:37, samkit993@gmail.com samkit993@gmail.com wrote:
Using Command Prompt, i am not able to pass arguments in Gujarati language. Is there any way out??
Have you followed the instructions at http://www.mediawiki.org/wiki/Manual:Pywikipediabot/Windows ? (the 'full unicode output' section). As far as I know, you should then be able to use non-ansi characters in a command shell, also as command-line parameters.
Best, Merlijn
Thanks Merlijn van Deen for your reply.
I have followed those instructions. But I cannot type in Gujarati in cmd. Everytime I have to type arguments in some other editor and then have to copy paste there, command prompt shows boxes instead of characters.
And Bot edits with ?????. So, instead of gujarati text , it prints question marks.
Thanks, Samkit.
On 25-Dec-12 5:56 PM, Merlijn van Deen wrote:
Hi Samkit,
On 25 December 2012 08:37, samkit993@gmail.com samkit993@gmail.com wrote:
Using Command Prompt, i am not able to pass arguments in Gujarati language. Is there any way out??
Have you followed the instructions at http://www.mediawiki.org/wiki/Manual:Pywikipediabot/Windows ? (the 'full unicode output' section). As far as I know, you should then be able to use non-ansi characters in a command shell, also as command-line parameters.
Best, Merlijn
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
Hi,
I've had those problems on windows and I did not know about the solution suggested by Merlijn. I usually worked around that by reading the data from a file insead of the prompt. Cygwin might also be a solution if you're familiar with *nix but forced to work on Windows [1]
Regards, Strainu
[1] http://cygwin.com/cygwin-ug-net/setup-locale.html
2012/12/25 samkit993@gmail.com samkit993@gmail.com
Thanks Merlijn van Deen for your reply.
I have followed those instructions. But I cannot type in Gujarati in cmd. Everytime I have to type arguments in some other editor and then have to copy paste there, command prompt shows boxes instead of characters. And Bot edits with ?????. So, instead of gujarati text , it prints question marks.
Thanks, Samkit.
On 25-Dec-12 5:56 PM, Merlijn van Deen wrote:
Hi Samkit,
On 25 December 2012 08:37, samkit993@gmail.com samkit993@gmail.com wrote:
Using Command Prompt, i am not able to pass arguments in Gujarati language. Is there any way out??
Have you followed the instructions at http://www.mediawiki.org/wiki/Manual:Pywikipediabot/Windows ? (the 'full unicode output' section). As far as I know, you should then be able to use non-ansi characters in a command shell, also as command-line parameters.
Best, Merlijn
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
Hi Samkit,
On 25 December 2012 15:16, samkit993@gmail.com samkit993@gmail.com wrote:
command prompt shows boxes instead of characters.
This is expected and OK - the command line has limited font capabilities, so, depending on the font used, some characters may show as boxes.
And Bot edits with ?????. So, instead of gujarati text , it prints
question marks.
This, however, is not. Did you set transliteration_target = None in user-config.py? Unfortunately, I do not have pywikipedia on windows at the moment, so it's not easy for me to test the behavior. Which version are you running? (run python version.py and copy-paste the output).
Best, Merlijn
Thanks Merlijn, here is my output from command prompt after running version.py "Pywikipedia [http] trunk/pywikipedia (r10802, 2012/12/16, 22:52:27) Python 2.7.3 |EPD_free 7.3-2 (32-bit)| (default, Apr 12 2012, 14:30:37) 500 32 bit (Intel)] config-settings: use_api = True use_api_login = True unicode test: ok"
I have also attached screenshot of my user-config.py.
-- Samkit
On 26-Dec-12 3:56 PM, Merlijn van Deen wrote:
Hi Samkit,
On 25 December 2012 15:16, samkit993@gmail.com samkit993@gmail.com wrote:
command prompt shows boxes instead of characters.
This is expected and OK - the command line has limited font capabilities, so, depending on the font used, some characters may show as boxes.
And Bot edits with ?????. So, instead of gujarati text , it prints
question marks.
This, however, is not. Did you set transliteration_target = None in user-config.py? Unfortunately, I do not have pywikipedia on windows at the moment, so it's not easy for me to test the behavior. Which version are you running? (run python version.py and copy-paste the output).
Best, Merlijn
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
Hi Samkit,
On 26 December 2012 14:34, samkit993@gmail.com samkit993@gmail.com wrote:
"Pywikipedia [http] trunk/pywikipedia (r10802, 2012/12/16, 22:52:27) I have also attached screenshot of my user-config.py.
Very strange - could you create a new file 'test.py' with the following contents and run 'python test.py'?
import wikipedia wikipedia.output(u'\u03c2\u03b9\u03ba\u03b9\u03c0\u03b5\u03b4\u03b9\u03b1')
Does this output a) ????ped?a, b) ςικιπεδια, or c) (yellow) sikipedia?
With a very basic user-config.py (and with the console_encoding and transliteration_target set as in your file), I get a) with raster fonts and b) with truetype fonts...
Best, Merlijn
Thanks Merlijn, I got (2) for 'Consolas' font and for 'Raster font', i got this weird output '????πεδ?α'.
-- Samkit
On Wednesday, December 26, 2012 7:59:57 PM, Merlijn van Deen wrote:
Hi Samkit,
On 26 December 2012 14:34, samkit993@gmail.com samkit993@gmail.com wrote:
"Pywikipedia [http] trunk/pywikipedia (r10802, 2012/12/16, 22:52:27) I have also attached screenshot of my user-config.py.
Very strange - could you create a new file 'test.py' with the following contents and run 'python test.py'?
import wikipedia wikipedia.output(u'\u03c2\u03b9\u03ba\u03b9\u03c0\u03b5\u03b4\u03b9\u03b1')
Does this output a) ????ped?a, b) ςικιπεδια, or c) (yellow) sikipedia?
With a very basic user-config.py (and with the console_encoding and transliteration_target set as in your file), I get a) with raster fonts and b) with truetype fonts...
Best, Merlijn
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
Hi Samkit,
On 26 December 2012 16:18, samkit993@gmail.com samkit993@gmail.com wrote:
Thanks Merlijn, I got (2) for 'Consolas' font and for 'Raster font', i got this weird output '????πεδ?α'.
OK, that is the expected output. If you set the font to Consolas, do you still get question marks in the output when running the bot? And if so, when does this happen (when you run which bot, with which commands?)
Best, Merlijn
Thanks, Merlijn, Yes, i am still getting question marks.Currently I am using my sandbox to edit with add_text.py file and 'page', 'text' commands.
-- Samkit On 26-Dec-12 8:54 PM, Merlijn van Deen wrote:
Hi Samkit,
On 26 December 2012 16:18, samkit993@gmail.com samkit993@gmail.com wrote:
Thanks Merlijn, I got (2) for 'Consolas' font and for 'Raster font', i got this weird output '????πεδ?α'.
OK, that is the expected output. If you set the font to Consolas, do you still get question marks in the output when running the bot? And if so, when does this happen (when you run which bot, with which commands?)
Best, Merlijn
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
Hi Samkit,
Sorry for not getting back to you on this sooner.
On 26 December 2012 16:42, samkit993@gmail.com samkit993@gmail.com wrote:
Yes, i am still getting question marks.Currently I am using my sandbox
to edit with add_text.py file and 'page', 'text' commands.
Could you mail the contents of your user-config.py file, as well as the complete command line for a command that gives you this error? That would make it possible for me to (hopefully) reproduce it locally.
Best, Merlijn
Thanks Merlijn, I got (2) for 'Consolas' font and for 'Raster font', i got this weird output '????πεδ?α'.
-- Samkit
On Wednesday, December 26, 2012 7:59:57 PM, Merlijn van Deen wrote:
Hi Samkit,
On 26 December 2012 14:34, samkit993@gmail.com samkit993@gmail.com wrote:
"Pywikipedia [http] trunk/pywikipedia (r10802, 2012/12/16, 22:52:27) I have also attached screenshot of my user-config.py.
Very strange - could you create a new file 'test.py' with the following contents and run 'python test.py'?
import wikipedia wikipedia.output(u'\u03c2\u03b9\u03ba\u03b9\u03c0\u03b5\u03b4\u03b9\u03b1')
Does this output a) ????ped?a, b) ςικιπεδια, or c) (yellow) sikipedia?
With a very basic user-config.py (and with the console_encoding and transliteration_target set as in your file), I get a) with raster fonts and b) with truetype fonts...
Best, Merlijn
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
pywikipedia-l@lists.wikimedia.org