Re: Is there an easy way to control indents in Python

2014-10-15 Thread ChrisKwpolskaWarrick
On Wed, Oct 15, 2014 at 9:27 AM, alex23  wrote:
> On 15/10/2014 12:23 PM, Juan Christian wrote:
>>
>> Using PyCharm is easy:
>>
>> File > Settings > (IDE Settings) Editor > Smart Keys > Reformat on paste
>>  > choose "Reformat Block"
>
>
>
> This isn't as straight forward as you imply. Say I have misindented code
> like this:
>
> if True:
> print 'true'
> else:
> print 'false'
> print 'done'
>
> If I select this block in PyCharm and reformat it, I get:
>
> if True:
> print 'true'
> else:
> print 'false'
> print 'done'
>
> Which is still invalid. Even if it did work more fully, though, how would it
> determine the correct placement of the last line of code?
> --
> https://mail.python.org/mailman/listinfo/python-list

It should parse this as

else:
print 'false'
print 'done'

Why?  Because things like `print 'done'` usually have an empty line before it:

if True:
print 'true'
else:
print 'false'

print 'done'

That should be parsed the way you want it done.  Makes perfect sense
when you look at it.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 2.76

2014-10-06 Thread ChrisKwpolskaWarrick
CC'ing the mailing list.

On Mon, Oct 6, 2014 at 5:29 PM, Sas Parmar
 wrote:
> Hi Chris
>
> I need to get in contact with the actual manufacturer of Python.
>
> Do you have an email address or phone number?

This is a very problematic question.  Why do you need to contact “the
manufacturer”?  Python is an open-source language with multiple people
involved.  Depending on what your query is, you may want the Python
Software Foundation, a release manager, tons of other people…  State
your question here and you may receive an answer or a pointer to
someone with an answer.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 2.76

2014-10-06 Thread ChrisKwpolskaWarrick
On Mon, Oct 6, 2014 at 4:30 PM, Joel Goldstick  wrote:
> […]
> No, I just meant to point out that these people are using a version of
> 2.7 with the OS the OP is using.
> Maybe that is helpful to know.

This would have assumed those people bothered keeping their Python
version up-to-date.

Now: Windows Server 2008 R2 is the server counterpart of Windows 7.
Which pretty much HAS to support recently released software (py2.7.6
was released 2013-11-10).  Nevertheless, it’d be nice to upgrade to
Python 2.7.8, which also supports the system, and features new
capabilities, bug fixes and security fixes (including Heartbleed…)
without breaking backwards compatibility.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Flask and Python 3

2014-09-25 Thread ChrisKwpolskaWarrick
On Thu, Sep 25, 2014 at 8:18 PM, Juan Christian
 wrote:
>> The thing is, it’s text.  I suppose I could use some text-to-speech
>> software to provide you with a video tutorial version of that.
>
>
> No, you can't, if you think a video tutorial is only that, I'm afraid to
> tell that you only saw terrible courses/tutorials in your life.

Go on, show me a good video tutorial.  One that is quick to consume,
and one I can come back to at any time I please (within reasonable
bounds).  I can just open a text-based tutorial and use my browser’s
search capabilities (or a Table of Contents or an index in an analog
book) to find the precise bit of knowledge I need.  You can’t easily
do that with video tutorials.

Also, video tutorials for code (as well as analog books) lack a very
important feature: copy-paste.  Nobody likes retyping large passages
of code.  Especially because it’s error-prone.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Flask and Python 3

2014-09-25 Thread ChrisKwpolskaWarrick
On Wed, Sep 24, 2014 at 9:39 PM, Juan Christian
 wrote:
> On Wednesday, September 24, 2014, Chris “Kwpolska” Warrick
>  wrote:
>>
>> Learning from videos is the worst thing you can do.  Use the official
>> flask documentation at http://flask.pocoo.org/docs/0.10/quickstart/ —
>> it’s much friendlier than a video.
>>
>> Also, there is nothing to “learn” — just change the line, and you will
>> have more helpful errors.
>
>
> That's the way I always learned everything. I watch some video courses, read
> a book and read the official documentation altogether.
>
> My way can't work for you, but for me it's excellent. And you don't even
> know which video/course I'm talking about, so it's gross to tell that
> "videos are the worst thing"...

It doesn’t matter.  Here, have some wisdom, as provided by the top
Google hit for “video tutorials suck”:
https://news.ycombinator.com/item?id=4565615

The thing is, it’s text.  I suppose I could use some text-to-speech
software to provide you with a video tutorial version of that.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Flask and Python 3

2014-09-24 Thread ChrisKwpolskaWarrick
On Wed, Sep 24, 2014 at 3:23 AM, Juan Christian
 wrote:
> I didn't learn debug with Flask yet. Only in the next videos.

Learning from videos is the worst thing you can do.  Use the official
flask documentation at http://flask.pocoo.org/docs/0.10/quickstart/ —
it’s much friendlier than a video.

Also, there is nothing to “learn” — just change the line, and you will
have more helpful errors.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python-distribute.org down

2014-09-17 Thread ChrisKwpolskaWarrick
On Wed, Sep 17, 2014 at 4:15 PM, Pierrick Koch  wrote:
> Hello,
>
> python-distribute.org server seems down,
> it was hosting the install script distribute_setup.py
> ( http://python-distribute.org/distribute_setup.py )
>
> meanwhile, you can find it here:
> https://gist.github.com/anonymous/947191a4635cd7b7f79a

distribute is long dead (probably why the website is down).  Use
setuptools instead:

https://pythonhosted.org/setuptools/
https://bootstrap.pypa.io/ez_setup.py

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Example of python service running under systemd?

2014-09-11 Thread ChrisKwpolskaWarrick
On Thu, Sep 11, 2014 at 7:48 PM, Travis Griggs  wrote:
> I’ve been reading lots of systemd docs. And blogs. Etc. At this point, I 
> think I would benefit from learning by example…
>
> Does anyone have an example .service file that they use to launch a long 
> running service written as a python program?
>
> If there is any example of what you changed to your python program itself, 
> that to would be really instructional for me.
> --
> https://mail.python.org/mailman/listinfo/python-list

Depends what you want.  If you are running a Python web app, you can
use uWSGI Emperor, which plugs into systemd nicely and provides a
.service file in the docs (which also ships with the Arch Linux
package).  Otherwise, there are various ways, and this all depends on
how you structure this and your needs.  Use Type=simple and you won’t
need any changes to your program, or use one of the more magical
methods and implement them.  Describe your needs to get more details.
-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to turn a string into a list of integers?

2014-09-05 Thread ChrisKwpolskaWarrick
On Sep 5, 2014 7:57 PM, "Kurt Mueller" 
wrote:
> Could someone please explain the following behavior to me:
> Python 2.7.7, MacOS 10.9 Mavericks
>
> >>> import sys
> >>> sys.getdefaultencoding()
> 'ascii'
> >>> [ord(c) for c in 'AÄ']
> [65, 195, 132]
> >>> [ord(c) for c in u'AÄ']
> [65, 196]
>
> My obviously wrong understanding:
> ‚AÄ‘ in ‚ascii‘ are two characters
>  one with ord A=65 and
>  one with ord Ä=196 ISO8859-1 
>  —-> why [65, 195, 132]
> u’AÄ’ is an Unicode string
>  —-> why [65, 196]
>
> It is just the other way round as I would expect.

Basically, the first string is just a bunch of bytes, as provided by your
terminal — which sounds like UTF-8 (perfectly logical in 2014).  The second
one is converted into a real Unicode representation. The codepoint for Ä is
U+00C4 (196 decimal). It's just a coincidence that it also matches latin1
aka ISO 8859-1 as Unicode starts with all 256 latin1 codepoints. Please
kindly forget encodings other than UTF-8.

BTW: ASCII covers only the first 128 bytes.

--
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
Sent from my Galaxy S3.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Looking for a suitable Python resource

2014-09-04 Thread ChrisKwpolskaWarrick
On Thu, Sep 4, 2014 at 8:13 PM,   wrote:
> Hello group members,
>
> I have worked with languages like C, C++, C#, Java and Objective C before.
>
> Now I want to learn Python. Most of the resources that I have seen online are 
> oriented mainly towards beginners to programming. Is there any other good 
> source which can be used by a person who knows the basics of programming 
> already?

The official Python tutorial should suit you:

version 2 — https://docs.python.org/2/tutorial/index.html
version 3 — https://docs.python.org/3/tutorial/index.html

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-08-31 Thread ChrisKwpolskaWarrick
On Sun, Aug 31, 2014 at 4:19 PM,   wrote:
> Hi,
>
> I have a puzzle, for which I would appreciate your opinion on!

That’s not much of a puzzle (a game, toy, or problem designed to test
ingenuity or knowledge, as defined by Oxford American College
Dictionary via http://google.com/search?q=define+puzzle ).  That’s a
problem.

> I have been trying to setup a project in Pycharm with psycopg2.
>
> If I install it using pip install it is added. However  if I use the Pycharm 
> "preferences>project interpreter>add package" option it fails with the below 
> message.

[snip]

> export 
> PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config

$PATH contains paths to directories, not binaries.  Change that line to:

export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.3/bin

If that is not enough to make pycharm do it, you may try to install
from the Terminal:

cd /path/to/your/virtualenv
bin/pip install psycopg2

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python conquors the BBC [was Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?]

2014-08-27 Thread ChrisKwpolskaWarrick
On Wed, Aug 27, 2014 at 2:58 AM, Twirlip2  wrote:
> It just pulls a lot of HTML and XML from the website, and extracts the
> addresses of various other pages, and eventually *.WMA streams, and
> hands the stream URLs over to XMPlay <http://www.un4seen.com/>.
>
> It 'knows' what pages to visit, because I have manually built up a plain
> text file containing a list of (at the moment) 274 BBC radio programmes,
> represented by 579 different mnemonic key strings - of which the user
> only needs to type in a sufficiently long initial segment to disambiguate.
>
> Anyone else could use the same list, or build up their own, or use mine as
> a basis for their own. (I just maintain it using a text editor.  I haven't
> [yet] attempted to do any database programming.)
>
> I have plenty of ideas for improving the program, but first I have to
> re-organise the present spaghetti code in a more logical fashion.

I have a better idea: use an existing solution.  get_iplayer, to be precise.

See here: http://www.infradead.org/get_iplayer/html/get_iplayer.html

It’s written in Perl.  They claim to have a Windows installer.  I have
not tested the Windows thing, but it worked fine when I set it up on
Linux, and managed to download a radio programme on August 12th.

Sample usage (on Linux, you might need to adjust for no grep)

$ get_iplayer --type=radio --refresh | grep 'Chris Evans'
12876:  The Chris Evans Breakfast Show - Borrowing Boyfriends, BBC
Radio 2, Discussion & Talk Shows,Entertainment,Music,Radio
12877:  The Chris Evans Breakfast Show - 21/08/2014, BBC Radio 2,
Discussion & Talk Shows,Entertainment,Music,Radio
12878:  The Chris Evans Breakfast Show - Peter Capaldi, Daniel
Radcliffe, Jon Hamm and Ruby Turner, BBC Radio 2, Discussion & Talk
Shows,Entertainment,Music,Radio
12879:  The Chris Evans Breakfast Show - John Bishop sits in, BBC
Radio 2, Discussion & Talk Shows,Entertainment,Music,Radio
12880:  The Chris Evans Breakfast Show - Babooshka!, BBC Radio 2,
Discussion & Talk Shows,Entertainment,Music,Radio
$ get_iplayer --type=radio 12878 --get

And kaboom, #12878, "Peter Capaldi, Daniel Radcliffe, Jon Hamm and
Ruby Turner", is downloaded and stored on your hard drive.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: GO vs Python

2014-08-25 Thread ChrisKwpolskaWarrick
On Mon, Aug 25, 2014 at 4:38 PM, Rustom Mody  wrote:
> On Monday, August 25, 2014 7:56:55 PM UTC+5:30, Marko Rauhamaa wrote:
>> Michael Torrie:
>
>> > On 08/25/2014 06:24 AM, Rustom Mody wrote:
>> >>> display artist names like M�tley Cr�e and Beyonc�, I would be more
>> >> Your mail client seems to be 7-bit ASCII!!
>> > No it came through fine here, originally. It must be Google Groups
>> > that messed up the characters in displaying the message and in your
>> > reply.
>
>> I saw it fine (news:comp.lang.python>), but there were no MIME
>> headers. MIME might not be part of the NNTP standard, but is a good idea
>> even there. GNUS must have guessed the encoding based on my locale.
>
>> Marko
>
> Mysterious...
>
> This page
> https://mail.python.org/pipermail/python-list/2014-August/677408.html
> shows charset as us-ascii
> And it shows Mötley Crüe and Beyoncé
> So it means ö ü é are us-ascii?
>
> [Of course I understand none of all this]
>
> रुसि [To force GG to unicode this message]
> --
> https://mail.python.org/mailman/listinfo/python-list

Your browser helpfully ignores that header and uses ISO-8859-1, which
*is* the actual encoding of that message.  Gmail displays the message
properly me, but apparently Google Groups defaults to UTF-8, and that
results in question marks.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: what do you get with 1 divide by 998001, interesting results

2014-08-21 Thread ChrisKwpolskaWarrick
On Thu, Aug 21, 2014 at 3:22 AM, Everything You Need To Know
 wrote:
> I do understand where you are coming from 'Chris "Kwpolska" Warrick', though, 
> your own self serving link to your own website and unproductive post is 
> closer to spam than my own, I offer something practical and positive to the 
> community, even if the wrong community to post.

You are speaking of the link in the signature.  Signatures are not
considered “content”.  You weren’t forced to read the signature, you
could’ve stopped at the dash-dash-space line; hell: modern e-mail
clients would helpfully hide this, or change its color, or in a
different way state “signature — no need to care”.

Unlike you, I haven’t just posted “read this amazing blog post!  only
500 words!  it does not explain things thoroughly!” in a way that many
spam filters would (or should) catch.  In fact, I never posted a thing
to promote my blog to this list in my life.  Besides, this is a
discussion list — announcements would fit the announcement list better
(comp.lang.python.announce on usenet/python-announce as ML).

On Thu, Aug 21, 2014 at 1:08 AM, Steven D'Aprano
 wrote:
> If you think it is spam (or at least borderline), perhaps you should not
> quote the url and provide links to the content?

Oh, sorry.  I forgot to edit and just had the message reproduced verbatim.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: what do you get with 1 divide by 998001, interesting results

2014-08-20 Thread ChrisKwpolskaWarrick
On Wed, Aug 20, 2014 at 5:36 PM, Everything You Need To Know
 wrote:
> Neat little exercise, surprisingly cool results!
> less than 3 minutes!
>
> https://www.youtube.com/watch?v=PlDjl5JK0eU&feature=youtu.be
> --
> https://mail.python.org/mailman/listinfo/python-list

Most subscribers are already skilled Python programmers and do not
care about your fancy tutorials.  Especially because they are video
tutorials, which are the worst way to learn anything — especially
programming.

Also, if someone really cares about the division, they can just watch
the original Numberphile video at
https://www.youtube.com/watch?v=daro6K6mym8 or any other sane source —
and not reproduce it with this weird division scheme.  Your video does
not tell a thing about the number anyway.

Please stop spamming with your barely original content.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to look up historical time zones by date and location

2014-08-18 Thread ChrisKwpolskaWarrick
On 18 August 2014 20:03 "Ian Kelly"  wrote:
> I also don't know why pytz shows the LMT offset in the repr for those
> timezones instead of the current UTC offset.

If pytz objects do not have a datetime object attached, they default to the
first ever entry, which is usually LMT. This can be problematic, as there
are ways to attach a ~100 years ago time zone object to a 2014 date.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
Sent from my SGS3.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How can I get the timezone time of a location?

2014-08-18 Thread ChrisKwpolskaWarrick
On 18 August 2014 04:28 "luofeiyu"  wrote:
>
> The land area of China is 60-degree longitude from west to east.
According to the demarcation of the world time zoning standard,
> the land area of China lies between the eastern fifth to ninth time
zones, there are 5 time zones in china in fact.
> Currently, all the places in China have adopted the eastern eighth time
zone for the sake of convenience. It is the so-called “Beijing Time”.
>
> I knew there is a difference between localtime and timezone time.
> Localtime: The official time in a local region (adjusted for location
around the Earth); established by law or custom.
> Timezone: Any of the 24 regions of the globe (loosely divided by
longitude) throughout which the same standard time is used.
> Timezone time : If location A is belong to timezone X, the time of
timezone X is the location A 's timezone time.

There is also solar time, which is defined as 12:00 = zenith.

> For Urumqi,localtime is the time of east 8 timezone, but timezone time is
the time of east 6 timezone.
> How can I get the timezone time of urumqi with python code?
>
> from datetime import datetime, timedelta
> from pytz import timezone
> import pytz
> tz = pytz.timezone('Asia/Urumqi')
> dt= tz.localize(datetime(2002, 10, 27, 6, 0, 0))
> fmt = '%Y-%m-%d %H:%M:%S %Z%z'
> print(dt.strftime(fmt))
> 2002-10-27 06:00:00 CST+0800
>
> It is a wrong answer,the timezone time is 2002-10-27 04:00:00 +0600
.2002-10-27 06:00:00 CST+0800 is the localtime for Urumiq(by law in china).

You can't use the Olson tz database (via pytz) for that. The database
registers legal time and not any of the others. Most people don't really
care about the other time standards. AFAIK there is no easy solution, you'd
have to calculate it manually from the longitude, which you'd have to find
somewhere (online?)
-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
Sent from my SGS3.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Which OAuth library?

2014-08-14 Thread ChrisKwpolskaWarrick
On 14 August 2014 18:51 "Richard Prosser"  wrote:
>
> I "need" one for use with Flask, as I don't really have time to implement
my own.

You should not implement things on your own if there are existing and same
implementations.

> Initially this will be for the "Two-Legged" case but I may well have to
support the "Three-Legged" version later on. "Open ID Connect" may also be
an option eventually.
>
> The basic idea is to provide an authorization/authentication service in a
fairly conventional manner. My boss has told me to use OAuth, probably
because he has experience with it and also to allow for third-party
transactions.
>
> However it is not clear to me how I should decide between the various
packages on offer. Any advice from experienced/informed users would be very
welcome.
>
>
> Thanks ...
>
> Richard
> --
> https://mail.python.org/mailman/listinfo/python-list

Google hints at https://flask-oauthlib.readthedocs.org/en/latest/ and it's
looking pretty good. There is also flask-oauth, but it seems quite outdated.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
Sent from my SGS3.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: a python console in bluestacks

2014-08-14 Thread ChrisKwpolskaWarrick
On Aug 14, 2014 9:23 AM, "luofeiyu"  wrote:
>
> i want to run python on my android phone ,to install python on bluestacks
is to emulate it .

In this case, you can install QPython, which supports the SL4A modules and
has a console. Or, you can install an app to access sh, like ConnectBot
(though better apps likely exist.)

Another alternative might be to use a real device with adb shell.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
Sent from my SGS3.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: newbee

2014-08-13 Thread ChrisKwpolskaWarrick
On Aug 13, 2014 9:34 PM, "Terry Reedy"  wrote:
> Have you verified that Idle *does* (not just *should*) run on RPi? (That
would mean having tcl/tk running, with whatever *it* requires on linux.) I
am working on Idle and the idea of people (especially hobbyists, students,
and other amateurs) running it on microsystems would really please me.

I don't have a RPi, but I know it is just a glorified ARM computer with
terrible specs. But it is enough to run LXDE or other lightweight graphical
environments, which means tcl/tk is VERY likely to work. You could also
look up packages for Raspbian or other RPi-friendly distros and see
python-tk there, or various Python tutorials for the device:

http://davidbriddock.blogspot.com/2013/04/learn-python-installing-tkinter.html

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
Sent from my SGS3.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: a python console in bluestacks

2014-08-13 Thread ChrisKwpolskaWarrick
On Aug 14, 2014 4:30 AM, "luofeiyu"  wrote:
>
> I have installed bluestacks(an android phone emulator) on my pc,and SL4A
on it.Now i can run python thish way :
> 1.edit an file ending with .py, save it in
/sdcard/sl4a/scripts/yourname.py.
> 2.open sl4a ,and click the file to make it run.
>
> Is there a python console to type python command to run python directly
such as in pc ?

Why are you using an Android emulator to run Python, a PC-first software?!
Just install the Windows version from http://python.org/ and use that.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
Sent from my SGS3.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: how to write file into my android phone?

2014-08-13 Thread ChrisKwpolskaWarrick
On Aug 14, 2014 8:11 AM, "alex23"  wrote:
>
> On 10/08/2014 7:08 PM, Chris “Kwpolska” Warrick wrote:
>>>
>>> 2) the phone isn't necessarily visible on a pc as a drive at all.
>>>   For example the Samsung gs4.
>>
>>
>> This is actually true for ALL android devices, starting with Android 3.0.
>
>
> This isn't true for my Samsung gs2 running Android 4.1.2.

Apparently, Samsung modified the feature for this phone, which shipped with
2.3 Gingerbread, to prevent breaking user experience.  Galaxy S3 shipped
with 4.0 ICS and uses MTP.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
Sent from my SGS3.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Linux distros w/o Python in "base" installation

2014-08-12 Thread ChrisKwpolskaWarrick
On Mon, Aug 11, 2014 at 8:53 PM, Grant Edwards  wrote:
> I just installed Arch Linux for the first time, and was surprosed to
> find that Python isn't installed as part of a "base" system.  It's
> also not included in the 'base-devel' package group.  It's trivial to
> install, but I'd still pretty surprised it's not there by default.  I
> guess I've spent too much time with Gentoo, Debian, and RedHat
> derivitives which require Python be installed.
>
> I've probably used at least a dozen Linux distros over the years, and
> this is the first time I've noticed that Python wasn't installed by
> default.

Arch has a different idea of “base system”.  The base group contains
the most crucial packages needed to run an Arch Linux system, and that
is all.  And you do not need Python to do so.  Nevertheless, most
people will likely install Python by themselves, or with a package
that depends on Python.

On Mon, Aug 11, 2014 at 9:02 PM, Chris Rebert  wrote:
> It would seem that such distros are opting to not be LSB-compliant?:
> http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Languages/LSB-Languages/pylocation.html

Arch does not really care about LSB, AFAIK.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: how to write file into my android phone?

2014-08-10 Thread ChrisKwpolskaWarrick
On Sun, Aug 10, 2014 at 12:23 AM, Dave Angel  wrote:
> 1) it's not necessarily j:   And not necessarily a single drive.

The OP claims it is a J: drive they want to write to.

> 2) the phone isn't necessarily visible on a pc as a drive at all.
>  For example the Samsung gs4.

This is actually true for ALL android devices, starting with Android 3.0.

It’s possible that the OP is running an ancient device, or a modern
one that appears as a USB drive for some reason (eg. custom ROM from
the manufacturer).

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: how to write file into my android phone?

2014-08-09 Thread ChrisKwpolskaWarrick
On Sat, Aug 9, 2014 at 7:56 PM, luofeiyu  wrote:
> When i input usb line with my android phone into the pc , there are two
> disks j: and k: (type :removable disk)  displayed in win7.
>
> i can get my android phone bluetooth mac address .
>
> import bluetooth
> nearby_devices = bluetooth.discover_devices(lookup_names = True)
> for addr, phoneName in nearby_devices:
> print(addr)
>
>
> it is  6C:8B:2F:CE:5B:59
>
> Now how can i write a file into the disk  j:  of my android phone(bluetooth
> mac is 6C:8B:2F:CE:5B:59 )?
>
> --
> https://mail.python.org/mailman/listinfo/python-list

You mixed up two very different interfaces.  Bluetooth and USB are
completely separate.  If you want to write a file to the USB drive,
you can just open a file, using the regular open() function (specify a
path somewhere benath J:\):

https://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files

However, if you want to do it via Bluetooth for some reason, you need
to find a library that does OBEX — Google hints at
http://lightblue.sourceforge.net/ .

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread ChrisKwpolskaWarrick
On Mon, Aug 4, 2014 at 2:17 AM, Glenn Linderman  wrote:
> For this OP problem, it is mostly a matter of finding a fixed-width font
> that supports the box drawing characters and the Polish characters that are
> desired.  Lucida Console has a fair repertoire, and Consolas has a fair
> repertoire, in the fixed-width font arena. There may be others, documented
> on Polish language web sites that I wouldn't know about, and I don't know
> enough Polish to be sure those I mentioned suffice.

Not really.  We haven’t had to play the “custom fonts for our
language” game for quite some time.  Consolas and Lucida Console work
just fine for Polish (though Consolas sometimes hiccups on capital
characters in some environments).  The characters are:

ĄĆĘŁÓŃŚŹŻ
ąćęłóńśźż

Most fonts — especially the ones included with modern OSes — support
all 18 of them.

So, this is a non-issue.  The real issue is Windows being an idiot
when it comes to CLI, which is oh so surprising to everyone who had to
work with it — considering the choice of the outdated and quirky
cmd.exe interpreter, or PowerShell, which has ultra-verbose
human-unfriendly commands and works in the same cmd.exe window (there
is a thing named PowerShell ISE, which circumvents cmd.exe; I have no
idea whether all the Unicode issues apply to that, too)

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: CodeSkulptor

2014-08-04 Thread ChrisKwpolskaWarrick
On Mon, Aug 4, 2014 at 4:08 AM, Seymore4Head
 wrote:
> I am just going to run 3.3 remotely.

Why and why?  3.3 is an old, outdated version — the most recent
version is v3.4.1.  By running 3.3 you are missing out on some new
features, and bugfixes.  You are better off running v3.4.1.

The other “why” refers to remotely running it on a Windows XP box.
This is a waste of time and resources. You are not going to save much
disk space, you can’t gain a thing, it’s not going to help: it will
just be a burden.  Especially because you’re running the remote box on
Windows (and an ancient version at that) — you are not running away
from all the issues of running in a Windows environment, and add
issues of running in a remote Windows environment.

Please stop, for your own good.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is there a tracker target for this mailing list?

2014-07-31 Thread ChrisKwpolskaWarrick
On Thu, Jul 31, 2014 at 3:38 PM, Anders Wegge Keller  wrote:
>  My spam filter have an issue with the way mails are sent to this list. If a
> mail sent to python-list is DKIM-signed, the DKIM-Signature header is kept
> in the mail. Since the mangling happening during distribution to the list
> changes one of the signed header fields, rather a lot of the mails to the
> list ends up in Spam.
>
>  So where to report this issue?
>
> --
> //Wegge
> --
> https://mail.python.org/mailman/listinfo/python-list

Start by fixing your server, Gmail treated you as spam.  Possible cause:

   dmarc=fail (p=REJECT dis=NONE) header.from=wegge.dk

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Unable to find ssh library supporting python 3.1

2014-07-30 Thread ChrisKwpolskaWarrick
On Wed, Jul 30, 2014 at 1:49 PM, Chirag Dhyani  wrote:
> Hi,
>
> Could you suggest me ssh library supporting python 3.1, to a surprise I
> checked pramiko, fabric, etc etc and no one does. even workaround with
> plumbum but not helpful. We have a project entirely on python 3.1 and now we
> are stuck with ssh.
>
> Please help
>
> Thank you
> ~Chi

Python 3.1.0 celebrated its fifth birthday on Sunday.  You should not
be using software that old.  There is no real reason to do so,
especially because modern versions of the 3.x series are generally
backwards compatible with each other.

Instead, upgrade to the most recent version, 3.4.1, which is happily
supported by Paramiko.  Many Python 3-compatible libraries
dropped/never had support for 3.0—3.2 due to
<http://legacy.python.org/dev/peps/pep-0414/>, which makes porting
between Python 2 and 3 much easier.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: .Net Like Gui Builder for Python?

2014-07-27 Thread ChrisKwpolskaWarrick
On Sun, Jul 27, 2014 at 2:24 PM, Steve Hayes  wrote:
> The main reason I use Evernote is that I found a book for it, and couln't find
> one for OneNote.

Both are actually self-explanatory.  You should not need a book to use
either, just an ability to read on-screen prompts and instruction.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: .Net Like Gui Builder for Python?

2014-07-27 Thread ChrisKwpolskaWarrick
On Sat, Jul 26, 2014 at 8:40 PM, Dennis Lee Bieber
 wrote:
>The way they package Office doesn't help... Ignoring the
> subscription-based "Office 365" I was at Best Buy a few weeks ago... The
> only local-install version of Office (Home&Office I think) had Word, Excel,
> and PowerPoint.
>
>How many /home/ users are creating presentations/slide-shows? Drop
> PowerPoint and include Access (which is essentially a GUI builder front-end
> for the Jet RDBM engine) and Publisher (seems a home user would do more
> with invitations, cards, and maybe reports/brochures)!

Access?  For a home user?  That’s insane!  Most home users actually
won’t use Access even if they have it.  It’s pretty complicated,
especially for your average Joe.

And Publisher could work out for a home user, except Word can do the
same, equally well (at least for a home user).  Why would they play
with a more complicated program, when they have a good enough thing in
Word?

Also, home users DO use PowerPoint.  One can make a photo album, for
example.  Or, if you have kids, they might have to create a
presentation for school (as a form of an essay).  PowerPoint is MUCH
more useful for a home user than (a) a user-unfriendly advanced
program; or (b) a more-or-less duplicate of what they have.

On Sun, Jul 27, 2014 at 6:49 AM, Steve Hayes  wrote:
> The one thing that isn't available with LibreOffice is OneNote, which you
> don't seem to be able to get separately, and doesn't seem to have any
> documentation (ie 3rd party books on it). But there is Evernote.

OneNote is actually available for free: http://www.onenote.com/
(though Evernote is superior)

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Exploring Python for next desktop GUI Project

2014-07-24 Thread ChrisKwpolskaWarrick
On Thu, Jul 24, 2014 at 8:33 PM, Zachary Ware
 wrote:
> On Thu, Jul 24, 2014 at 12:04 PM, Chris “Kwpolska” Warrick
>  wrote:
>> Tk is neither sane
>
> How so?  Like any other facet of programming, using Tk(inter) has it's
> frustrations, but for the most part it has always worked as expected
> for me.  Granted, I haven't done anything terribly fancy.

Pretty much everyone in the world hates Tcl and Tk.  Ask your favorite
search engine for some results.

i’ve tried to write a Tkinter thing once.  I don’t have a copy anymore
(consciously deleted), but I vaguely remember some issues with widgets
that do not work.  I also remember that the list of widgets is quite
small and not enough for many projects.

>> nor native-feeling, especially on Linux, where it looks
>> like something from two decades ago.
>
> The problem there is that on Linux, "native" could mean "GTK", "QT",
> or something else entirely.

The best way to handle this is just choose one of the two (wxwidgets
chose GTK 2, for example) and be considered native enough by most, as
people don’t really mind mixing them (as there are no good Qt web
browsers, and VLC uses Qt and not GTK)

> Also, just to make sure, you are talking about "ttk" rather than plain "tk", 
> right?

ttk on Linux doesn’t change a thing.  It still uses the ugly, ancient,
motif-esque style:

https://www.google.com/search?q=tk+linux&tbm=isch

(also, off by 10 years, motif is actually from the 1980s.)

On Thu, Jul 24, 2014 at 8:51 PM, Chris Angelico  wrote:
> On Fri, Jul 25, 2014 at 4:33 AM, Zachary Ware
>  wrote:
>>> On other platforms, it also is not 100%
>>> native.
>>
>> On Windows, at least, ttk comes very very close to it.
>
> What exactly does that mean? The Windows default UI changed
> significantly from W2K -> XP -> Win8, and each time, it's possible to
> revert to the old styling; does ttk follow the rest of the OS in that?

There is one more catch, custom themes can be installed after you
patch some files (which can be done in 5 minutes by anyone with
sufficient googling and reading comprehension skills).

AFAIK, Qt follows the system style properly, and it looks quite native
on every Windows OS.  No idea about ttk though.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Exploring Python for next desktop GUI Project

2014-07-24 Thread ChrisKwpolskaWarrick
On Jul 24, 2014 6:28 PM, "Zachary Ware" 
wrote:
>
> On Thu, Jul 24, 2014 at 10:57 AM, Noble Bell  wrote:
> > I am exploring the idea of creating my next desktop GUI project in
Python and would like a little advice from you folks about a couple of
requirements.
> >
> > My requirements will be:
> > 1. Needs to be portable across platforms with native LAF
(Windows,Linux,OSX)
>
> The Python standard library includes the tkinter package, which is an
> interface to Tcl/Tk.  The 'ttk' module provides themed/themable
> widgets that have the platform-native look by default.  I've
> successfully used tkinter for a few projects, and have kept most of my
> sanity :).  One of the biggest benefits to tkinter is that, since it
> is included with Python, so you don't have to distribute a separate
> GUI toolkit.

Tk is neither sane nor native-feeling, especially on Linux, where it looks
like something from two decades ago. On other platforms, it also is not
100% native.

I personally recommend PyQt4/PySide. wxPython is also worth checking out.
And it might be better to stay with Python 2, there are still things that
don't work with Py3k that you might find crucial.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
Sent from my SGS3.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: I am stuck on OOP

2014-07-19 Thread ChrisKwpolskaWarrick
On Sat, Jul 19, 2014 at 5:44 PM, Sibylle Koczian  wrote:
> Am 18.07.2014 20:45, schrieb Chris “Kwpolska” Warrick:
>
>> Yes, exceptions do exist. But most video tutorials are produced by
>> people without enough knowledge, and people that should not be working
>> on educational material. This is especially visible in videos about
>> basic things: they can be produced by just about anyone with a
>> microphone — which never leads to anything good. (In order to be more
>> precise, I'd have to be politically incorrect.)
>>
>
> Moreover people knowing enough about the subject and being able to explain
> it really well won't necessarily speak clearly. And spoken English is so far
> away from the written version anyway that it's simply a pain for everybody
> with another first language.

Depends on the person.  I’m perfectly fine with spoken English (as
long at it isn’t produced by Asians and other badly-speaking people),
and it’s not my mother tongue.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Pip doesn't install my scripts

2014-07-19 Thread ChrisKwpolskaWarrick
On Sat, Jul 19, 2014 at 9:19 AM, Yaşar Arabacı  wrote:
> Hi,
>
> I am trying to package my file, but I am having problems with
> installing my Scripts. Here is my package:
> https://github.com/yasar11732/tklsystem
>
> Here is my package's PyPi page: https://pypi.python.org/pypi/TkLsystem
>
> The problem I face is that, when I run `python setup.py install` from
> my development directory, I see that script file is installed.
> However, if I run `pip install TkLsystem`, my script file is not
> copied to Scripts directory.
>
> What am I doing wrong here?
>
> --
> http://ysar.net/
> --
> https://mail.python.org/mailman/listinfo/python-list

Tons of things are wrong.

* SyntaxError: Non-ASCII character '\xc5' in file lsystem/__init__.py
on line 6, but no encoding declared; see
http://python.org/dev/peps/pep-0263/ for details
* you should not import your package in setup.py
* you are python 3-only for no real reason at all
* the zip on PyPI is for version 0.1.3.  It ignores the version 0.1-5,
because of the dash, which should not be used in names of stable
software
* and, most importantly, you’re doing things using ancient methods.
Upgrade your setup.py to use setuptools, and its entry points
mechanism.

I’ve sent a PR to fix all of your errors:
https://github.com/yasar11732/tklsystem/pull/1

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3.4.1 64 bit Version

2014-07-19 Thread ChrisKwpolskaWarrick
On Sat, Jul 19, 2014 at 1:23 AM, Terry Reedy  wrote:
> On 7/18/2014 2:56 PM, Chris “Kwpolska” Warrick wrote:
>
>> It’s also slightly easier to find pre-made binaries for 32-bit than
>> 64-bit.
>
>
> Searching 'python windows binaries' on Google and the first hit is
> http://www.lfd.uci.edu/~gohlke/pythonlibs/
> "This page provides 32- and 64-bit Windows binaries of many scientific
> open-source extension packages for the official CPython distribution of the
> Python programming language."
>
> He or they are currently compiling both 32 and 64 bits binaries for 2.7,
> 3.3, and 3.4.

I know that site, but its binaries are not used by `pip` while wheels
published on PyPI are — and those wheels are not always available for
64-bit.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3.4.1 64 bit Version

2014-07-18 Thread ChrisKwpolskaWarrick
On Fri, Jul 18, 2014 at 3:54 PM, Zachary Ware
 wrote:
> On Fri, Jul 18, 2014 at 8:48 AM, Chris “Kwpolska” Warrick
>  wrote:
>> “win32” is the name given to the Windows API as of Windows NT 3.1 and
>> Windows 95.  The “AMD64” part in parentheses tells the truth, that
>> you’re actually running the 64-bit version (which can cause problems,
>> though — it’s better to use the 32-bit version, IMO)
>
> What problems have you run into with the 64-bit version?  The only
> issues I've had have been my own problems with installing some
> versions as 32-bit and others as 64, and forgetting which was which.

This is one of the issues: you can easily mess up 32-bit and 64-bit,
and not even notice that (AppVeyor had an issue with that lately —
they switched python to 64 but left VC++ as 32).

It’s also slightly easier to find pre-made binaries for 32-bit than
64-bit.  In general, life in 64-bits on Windows is kinda hard, for
everyone involved.


-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: I am stuck on OOP

2014-07-18 Thread ChrisKwpolskaWarrick
On Jul 18, 2014 8:36 PM, "Steven D'Aprano" <
steve+comp.lang.pyt...@pearwood.info> wrote:
> I would normally agree with you about
> text being better than video, but I watched a video explaining git and it
> made much more sense than anything I've read.

Yes, exceptions do exist. But most video tutorials are produced by people
without enough knowledge, and people that should not be working on
educational material. This is especially visible in videos about basic
things: they can be produced by just about anyone with a microphone — which
never leads to anything good. (In order to be more precise, I'd have to be
politically incorrect.)

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
Sent from my SGS3.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3.4.1 64 bit Version

2014-07-18 Thread ChrisKwpolskaWarrick
On Fri, Jul 18, 2014 at 3:29 PM,   wrote:
> The version given on Python.org is "Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 
> 2014, 10:45:13) [MSC v.1600 64 bit (AMD64)] on win32".
>
> This question is prompted by difficulties installing PyScripter.  What does 
> "on win32" mean in the above.  I was using PyScripter on an AMD64 processor 
> with Python 2.7.  Now, with an attempt to move to Python 3, I have grief.
>
> How does one install "python-3.4.1.amd64-pdb"?
>
> I would welcome any advice.
>
> Thanks,
>
> Colin W.
> --
> https://mail.python.org/mailman/listinfo/python-list

“win32” is the name given to the Windows API as of Windows NT 3.1 and
Windows 95.  The “AMD64” part in parentheses tells the truth, that
you’re actually running the 64-bit version (which can cause problems,
though — it’s better to use the 32-bit version, IMO)

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: I am stuck on OOP

2014-07-18 Thread ChrisKwpolskaWarrick
On Fri, Jul 18, 2014 at 1:40 PM, Nicholas Cannon
 wrote:
> Just quickly i am quite stuck on OOP and i really need like a good video and 
> i cant find any. If anyone knows any please link it i really need it because 
> i know OOP is important.

> video

There’s your problem: video tutorials are the most evil invention of
the human race.  It’s hard to learn from them.  You should not watch
any — use text tutorials instead.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3 is killing Python

2014-07-16 Thread ChrisKwpolskaWarrick
A little more off-topic:

On Wed, Jul 16, 2014 at 3:57 AM, MRAB  wrote:
> On 2014-07-16 00:53, Rick Johnson wrote:
>> Some folks even have software that "blabs" about how great a job it
>> is doing […], so if you see […] some pretentious line
>> about "this was sent from my i-phone" -- send that crap to the
>> bitbucket!
>>
> "This was sent from my iPhone" == "I have an iPhone!"

I personally parse those lines as “sent from my iPhone, which has an
on-screen touch keyboard, and it’s harder to type on it”.

> Also annoying is some footnote that says that the email contains
> confidential information and that if you're not the intended recipient
> you should delete it, etc.
>
> That's somewhat pointless if it's being sent to a public forum!

Corporate lawyers for the win!  99.9% of people who send e-mail with
this line are forced to do so by their corporation’s legal department.

Also, the correct solution for all those is getting a sane client that
can hide quotes and signatures.  Like Gmail (which defaults to
top-posting, but fixing this is one click per message away*).  And if
someone brings the “people need to download it anyway” argument: it’s
2014, people: hard-drives are large nowadays (or you can just use
IMAP) and if you’re paying $100 per kilobyte, you’re doing it wrong
and should not be online in the first place.

* trickier on mobile, though.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: I am confused about ' and "

2014-07-10 Thread ChrisKwpolskaWarrick
On Jul 10, 2014 7:53 PM, "fl"  wrote:
>
> Hi,
>
> It is still in the Regular expression operations concept, this link:
>
> has example using single quote mark: '
>
> https://docs.python.org/2/library/re.html#re.split
>
>
> While in this link:
>
> https://docs.python.org/3/howto/regex.html
>
>
> It gives table with quote: "
>
> Regular String  Raw string
> "ab*"   r"ab*"
> "section"   r"\\section"
> "\\w+\\s+\\1"   r"\w+\s+\1"
>
>
> and link:
>
> https://docs.python.org/2/library/re.html
>
>
> m = re.match(r"(\w+) (\w+)", "Isaac Newton, physicist")
>
>
> Please tell me because I have looked it around for one hour about it.
>
> Thanks,
> --
> https://mail.python.org/mailman/listinfo/python-list

Both characters (' and ") are interchangeable, the only difference
being the one you need to escape if you want to use in a string:
"you're" vs 'you\'re', and the other way around.

Also, please read the Python tutorial[0] before getting into bigger
things, and please don’t mix documentation versions.  If you were to
read the tutorial, you’d quickly find out, that

> 3.1.2. Strings
>
> Besides numbers, Python can also manipulate strings, which can be
> expressed in several ways. They can be enclosed in single quotes
> ('...') or double quotes ("...") with the same result [2]. \ can be
> used to escape quotes.
>
> [snip]
>
> [2] Unlike other languages, special characters such as \n have the
> same meaning with both single ('...') and double ("...") quotes.
> The only difference between the two is that within single quotes
> you don’t need to escape "(but you have to escape \') and vice
> versa.


[0]: https://docs.python.org/2/tutorial/index.html

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What does (A ``quote'' is the character used to open the string, i.e. either ' or ".) mean?

2014-07-10 Thread ChrisKwpolskaWarrick
On Thu, Jul 10, 2014 at 4:04 PM, fl  wrote:
> Hi,
>
> For me, it is difficult to understand the last line of the paragraph below in
> parenthesis (A ``quote'' is the character used to open the string,
> i.e. either ' or ".)
>
> It talks about triple-quoted strings. Where is ``quote'' from? It has two ` 
> and '.
> What this different ` and ' do for here?
>
> The link is here:
> https://docs.python.org/2.0/ref/strings.html
>
> Thank you for helping me to learn Python.

Please don’t learn from this link.  It’s from 2001.  You should learn
from modern documentation: https://docs.python.org/ (if not running
3.4.x, change the version in the top)

You also should not read the language reference, it’s meant for people
who really care about what’s under the hood.  The official tutorial is
better for learning: https://docs.python.org/3/tutorial/index.html

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PEP8 and 4 spaces

2014-07-04 Thread ChrisKwpolskaWarrick
On Thu, Jul 3, 2014 at 7:31 PM, Tobiah  wrote:
> Anyway, I gave up the 80 char line length long
> ago, having little feeling for some dolt on
> a Weiss terminal that for some reason needs to
> edit my code.

And yet, you did not give up an even more insane line length limit, in
e-mail.  The longest line in your original message is a measly 57
characters long.  The median line length is 46 characters.  Which is
pretty insane, and ultra-hard to read.  You can do more in e-mail.

> Each line of characters MUST be no more than 998 characters, and
> SHOULD be no more than 78 characters, excluding the CRLF.

That's the standard, [RFC 5322][]; the exact same quote appeared back
in [RFC 2822][].  However, many places actually want you to use a bit
less; common values include 70 or 72.  But still, it is MUCH more
roomy and readable than the value you use.

Here are the line lengths in the original message:

[47, 45, 45, 46, 46, 47, 45, 5, 46, 43, 46, 47, 47, 49, 31, 57, 52,
 34, 42, 23]

[RFC 5322]: http://tools.ietf.org/html/rfc5322#section-2.1.1
[RFC 2822]: http://tools.ietf.org/html/rfc2822#section-2.1.1

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: why i can't install ez_setup

2014-06-28 Thread ChrisKwpolskaWarrick
On Sat, Jun 28, 2014 at 1:49 PM, 水静流深 <1248283...@qq.com> wrote:
> I have downloaoded ez_setup.py ,when i install it ,the wrong message:
>
>>python  d:\ez_setup.py
> Downloading
> https://pypi.python.org/packages/source/s/setuptools/setuptools-5.2.
> zip
> Exception calling "DownloadFile" with "2" argument(s): "Unable to connect to
> th
> e remote server"
> At line:1 char:152
> + [System.Net.WebRequest]::DefaultWebProxy.Credentials =
> [System.Net.Credential
> Cache]::DefaultCredentials; (new-object System.Net.WebClient).DownloadFile
> <<<<
>  ('https://pypi.python.org/packages/source/s/setuptools/setuptools-5.2.zip',
> 'C
> :\\Users\\pengsir\\setuptools-5.2.zip')
> + CategoryInfo  : NotSpecified: (:) [],
> MethodInvocationException
> + FullyQualifiedErrorId : DotNetMethodException
>
> Traceback (most recent call last):
>   File "d:\ez_setup.py", line 332, in 
> sys.exit(main())
>   File "d:\ez_setup.py", line 327, in main
> downloader_factory=options.downloader_factory,
>   File "d:\ez_setup.py", line 287, in download_setuptools
> downloader(url, saveto)
>   File "d:\ez_setup.py", line 192, in download_file_powershell
> _clean_check(cmd, target)
>   File "d:\ez_setup.py", line 169, in _clean_check
> subprocess.check_call(cmd)
>   File "d:\Python27\lib\subprocess.py", line 540, in check_call
> raise CalledProcessError(retcode, cmd)
> subprocess.CalledProcessError: Command '['powershell', '-Command',
> "[System.Net.
> WebRequest]::DefaultWebProxy.Credentials =
> [System.Net.CredentialCache]::Default
> Credentials; (new-object
> System.Net.WebClient).DownloadFile('https://pypi.python
> .org/packages/source/s/setuptools/setuptools-5.2.zip',
> 'C:Userspengsir\\
> \\setuptools-5.2.zip')"]' returned non-zero exit status 1
>
> what is wrong with it?

Either (a) pypi, or (b) you were offline when trying to install.

Also, you generally want to use get-pip.py instead, it will also get
you pip in addition to setuptools:

https://bootstrap.pypa.io/get-pip.py

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Fwd: What can Nuitka do?

2014-06-28 Thread ChrisKwpolskaWarrick
On Sat, Jun 28, 2014 at 7:40 AM, CM  wrote:
> I'm confused as to why it's not just a .py file.

On Linux, the `nuitka` script would be run.  Things in $PATH tend not
to have an extension, and you don’t need one to run Python.  (you
can’t import files that don’t end in .py, though)

> The nuitka.bat, aside from some remarks, is this:
>
> @echo off
> setlocal
>
> "%~dp0..\python" "%~dp0nuitka" %*
>
> endlocal
>

This is a very fancy way of running Nuitka in the local python
interpreter, with all the arguments.  For example, this:

C:\Python27\Scripts\nuitka.bat foo bar

will make the script run:

C:\Python27\python C:\Python27\Scripts\nuitka foo bar

This is to make Windows users’ life easier, to provide them
executables that work just as `nuitka` (and not `nuitka.py`).
However, a more modern method than the one used here is setuptools
entrypoints, which produces a nicer .exe file.

--
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: can I get 0./0. to return nan instead of exception?

2014-06-19 Thread ChrisKwpolskaWarrick
On Thu, Jun 19, 2014 at 1:31 PM, Joel Goldstick
 wrote:
>
> On Jun 19, 2014 7:05 AM, "Neal Becker"  wrote:
>>
>> Can I change behavior of py3 to return nan for 0./0. instead of raising an
>> exception?
>
> There is no nan in python.

Wrong:

>>> float('nan')
nan
>>>

also:

https://docs.python.org/2/library/math.html#math.isnan

> Check if the float x is a NaN (not a number). For more information on NaNs, 
> see the IEEE 754 standards.

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Shared web hosting where python is *not* a second class citizen

2014-05-25 Thread ChrisKwpolskaWarrick
On Sun, May 25, 2014 at 7:25 PM, memilanuk  wrote:
> Right now we have a fairly basic shared hosting plan via bluehost.com,
> running WordPress for a club web site.  I've looked at setting up python
> on this account, but the default is the version of python that comes
> with the OS (CentOS 5.x currently).  There are some basic instructions on
> upgrading that at a user level to 2.7... but nothing for python3, and most
> of the python posts in their user forums go unanswered.  Not exactly
> confidence inspiring!  The irony is that one of my web searches included a
> review of shared hosting and listed BlueHost as the number one
> recommendation!
>
> So I'm left wondering if there is someplace that people here would recommend
> (for this kind of plan or others) where python isn't a second class citizen.
> Really not interested (for my current uses) in a VPS.  I just want some
> place where it doesn't feel like python support is some sort of bone thrown
> out there just to say that they 'support' python.

Heroku, Google App Engine, or pretty much any other
Platform-as-a-Service provider.

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: TeX $\times$ symbol not working in matplotlib?

2014-04-18 Thread ChrisKwpolskaWarrick
On Fri, Apr 18, 2014 at 6:18 PM, gwhite  wrote:
> I am trying to understand how to get the TeX "\times" symbol to work.  It is 
> in the title() string in the code I pasted in.  The "\circ" symbol seems 
> fine, by comparison.  "\times" ends up as "imes" in the figure title.
>
> I am probably doing something dumb (hey, maybe a lot of dumb things!), but if 
> you can spot and describe my mistake, I would be quite happy about that.

> plt.title('$\mathrm{poles}$ $(\times)$ \
>$\mathrm{\&}$ $\mathrm{zeros}$ \
>$(\circ)$ $\mathrm{of}$ $T(s)T(-s)$',\
>fontsize=16)

You’re using a regular string.  In which backspaces can be used in
escapes.  \t is one of those escapes, it is the tab character.  In
order to fix, add the letter "r" before the opening quote.  Like this:

> plt.title(r'$\mathrm{poles}$ $(\times)$ \
>$\mathrm{\&}$ $\mathrm{zeros}$ \
>$(\circ)$ $\mathrm{of}$ $T(s)T(-s)$',\
>fontsize=16)

Moreover, in the next two things, you already did it right in the first place:

> plt.xlabel(r'$\sigma$', fontsize=16)
> plt.ylabel(r'$\mathrm{j}\omega$', fontsize=16)

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: change spacing to two instead of four with pep8 or flake8?

2014-04-08 Thread ChrisKwpolskaWarrick
On Tue, Apr 8, 2014 at 5:06 AM, Dennis  wrote:
> Hi,
>
> In Pylint you can change the spacing multiplier from 4 spaces to two
> in its pylintrc, but for the life of me I cannot find a way to do this
> with the flake8 / pep8 utilities.
>
> I want to avoid ignoring E111 altogether if at all possible, because
> it may catch other spacing problems that are not as obvious.
>
> hacky/non-hacky solutions welcome of course.
>
> If this is too specific and I should go to the pep8/flake8 MLs that is
> welcome advice too.
>
> Thanks,
>
> Dennis
> --
> https://mail.python.org/mailman/listinfo/python-list

You are trying to use tools that enforce a set of rules, one of which
is “use 4 spaces per indentation level”.  If you don’t agree with this
rule, simply don’t use tools that enforce these rules.  It’s that
easy.

But note, that E111 is “indentation is not a multiple of four”.  Which
you are never going to listen to anyways if you want 2 spaces per
indentation level.  If you *really* want to do 2 spaces (and look
weird), then just ignore that.

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Calculating time differences given daylight savings time

2014-04-03 Thread ChrisKwpolskaWarrick
On Thu, Apr 3, 2014 at 3:45 AM, Washington Ratso  wrote:
> I am running Python 2.7 and would like to be able to calculate to the second 
> the time difference between now and some future date/time in the same 
> timezone while taking into account daylight savings time.  I do not have 
> pytz.  Any ideas how to do it?
>
> If it requires having pytz, how would I do it with pytz?
>
> Thank you.
> --
> https://mail.python.org/mailman/listinfo/python-list

It requires having pytz, or dateutil, in order to get timezone
objects*.  You can also create those objects yourself, but that’s
tricky — and you SHOULD NOT do time zones on your own and just use
something else.  Why?  See [0].

Example with pytz:

# Necessary imports
import pytz
from datetime import datetime

# the timezone in this example is Europe/Warsaw — use your favorite one
tz = pytz.timezone('Europe/Warsaw')

now = datetime.now(tz)
# Note I’m not using the tzinfo= argument of datetime(), it’s flaky
and seemingly uses a historic WMT (+01:24) timezone that is dead since
1915.
future = tz.localize(datetime(2014, 12, 24))

# And now you can happily do:

delta = future - now

# and you will get the usual timedelta object, which you can use the usual way.


###

* pytz ships the Olson tz database, while dateutil maps uses your
system’s copy of the tz database (if you are on Linux, OS X or
anything else that is not Windows, really) or maps to the Windows
registry.  Use whichever suits you.

[0]: http://www.youtube.com/watch?v=-5wpm-gesOY

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Time we switched to unicode?

2014-03-25 Thread ChrisKwpolskaWarrick
On Tue, Mar 25, 2014 at 9:05 AM, Marko Rauhamaa  wrote:
> Chris Angelico :
>
>> On Tue, Mar 25, 2014 at 4:14 PM, Mark H Harris  wrote:
>>>>>> Π¹ = pi
>>
>> That's good! (Although typing Π¹ quicker than pi is majorly pushing it.
>
> It don't think that's good. The lower-case letter π² should be used. The
> upper-case letter is used for a product, although unicode dedicates a
> separate character for the purpose: ∏³.
>
> I often see Americans, especially, confuse upper and lower-case letters
> in symbols ("KM" for "km", "L" for "l" etc).


“L” is actually valid, and so is “l”.  This happens mainly because
humans (and computers) tend to write “1 l” (one liter, one-ell) in a
way that makes it harder to distinguish (becoming eleven or ell-ell),
especially if you don’t include the space (which is invalid).

On Tue, Mar 25, 2014 at 9:23 AM, Chris Angelico  wrote:
> If you can type a capital ∏³, you can type a lower-case π², unless there's 
> something very weird going on.

Nitpick time!  (because we all love it so much!)

Π¹ = U+03A0 GREEK CAPITAL LETTER PI
π² = U+03C0 GREEK SMALL LETTER PI
∏³ = U+220F N-ARY PRODUCT

“If you can type an N-ARY PRODUCT, you can type a GREEK SMALL LETTER
PI, unless there’s something very weird going on.”

…like, the user is in the past and is using ISO 8859-7 (instead of a
21st-century encoding, like UTF-8).  An encoding which has support for
Π¹ and π², but not for ∏³… (of course, this assumes that, if we add
those new characters into python, we allow any encoding, somehow.)

That’s not too weird, other than the ancient encoding being used.
(though that’s a bit less weird on Windows, but that’d be
Windows-1253.)

Oh: and speaking of fancy Unicode characters that are worthless
~duplicates, spot the difference here:

µ μ

If you are lucky enough (and, luckiness may involve reading this
e-mail in Helvetica (not Neue though) on a Mac), you can clearly see
that they are different.  If you are using a font that does not
differentiate them, you may think they’re the same.  If you ask some
intelligent software (like `unicodedata.name()` in Python), you’ll
quickly find out the first is MICRO SIGN, and the other is GREEK SMALL
LETTER MU.  Such craziness is what makes Unicode Unicode.

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Github down?

2014-03-21 Thread ChrisKwpolskaWarrick
On Fri, Mar 21, 2014 at 2:48 PM, Skip Montanaro  wrote:
> On Fri, Mar 21, 2014 at 8:24 AM, Larry Martell  
> wrote:
>> https://twitter.com/githubstatus
>
> Thanks for the pointer. I'm an old fart and don't use social media
> much (in fact, just closed my FB account a couple days ago). Does that
> mean I'm a curmudgeon? :-)

If you dislike social media (or prefer a nice website with graphs and
such), then go there:

https://status.github.com/

(though GitHub could qualify as social media for some…)

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: test

2014-03-16 Thread ChrisKwpolskaWarrick
On Sun, Mar 16, 2014 at 4:41 AM, Mark H Harris  wrote:
> I have been having a fit with gg, and its taken just a little time to get a
> real news-reader client for posting. What a fit. Google does really well
> with some things, but gg is not one of them, IMHO.

Why not use the mailing list instead?  It’s a much easier way to
access this place.

https://mail.python.org/mailman/listinfo/python-list

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The sum of numbers in a line from a file

2014-02-20 Thread ChrisKwpolskaWarrick
On Thu, Feb 20, 2014 at 7:16 PM,   wrote:
> What I've got is
> def stu_scores():
> lines = []
> with open("file.txt") as f:
> lines.extend(f.readlines())
> return ("".join(lines[11:]))

This returns a string, not a list.  Moreover, lines.extend() is
useless. Replace this with:

def stu_scores():
with open("file.txt") as f:
lines = f.readlines()
return lines[11:]

> scores = stu_scores()
> for line in scores:

`for` operating on strings iterates over each character.

> fields = line.split()

Splitting one character will turn it into a list containing itself, or
nothing if it was whitespace.

> name = fields[0]

This is not what you want it to be — it’s only a single letter.

> sum1 = int(fields[4]) + int(fields[5]) + int(fields[6])

Thus it fails here, because ['n'] has just one item, and not nine.

> sum2 = int(fields[7]) + int(fields[8])
> average1 = sum1 / 3.0
> average2 = sum2 / 2.0
> print ("%s %f %f %") (name, average1, average2)
>
> It says that the list index is out of range on the sum1 line. I need 
> stu_scores because the table from above starts on line 11.
> --
> https://mail.python.org/mailman/listinfo/python-list



-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Wheezy.web - is it been developed?

2014-02-19 Thread ChrisKwpolskaWarrick
On Wed, Feb 19, 2014 at 8:18 AM, Andriy Kornatskyy
 wrote:
> I believe the web framework should not be something cryptic (requiring 
> community to exchange ideas about workarounds) nor something that involves 
> infinitive development cycle.

Having lots of humans give support is much better when you have
problems.  You are more likely to get a quick response from a big
group of humans than from one developer.

On Wed, Feb 19, 2014 at 12:31 PM, Marcio Andrey Oliveira
 wrote:
> I navigated in its site. I just feel strange that no one wrote tutorials of 
> it (not counting some speed testing) and that there is no Wheezy.web 
> community (yet).

I personally suggest trying something more popular, like Flask,
Bottle, Pyramid, or Django (though it’s quite big and complicated).
Lots of tutorials exist for those.  There are big, vivid communities
offering help and support.  You can often find good solutions for
popular problems (like user accounts) without reinventing wheels.
Flask is the easiest option, and it’s very popular.

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Requests script to login to a phpbb forum

2014-02-19 Thread ChrisKwpolskaWarrick
On Wed, Feb 19, 2014 at 12:46 PM, Leo  wrote:
> Hi there,
>
> I have decided to jump in at the deep end to try and learn python. I have
> been able to get requests to pull the login page off the server and I think
> send the login request. I don't get logged in though. Please let me know if
> I would be better off asking in a phpBB related group or forum.
> Here is my code without username and password included:

You need cookies.  In order to do it, simply use sessions instead of
the “global” API.  Code:

import requests

payload = {'username': 'username', 'password': 'password'}
session = requests.Session()
r = session.post("http://www.tt-forums.net/ucp.php?mode=login",data=payload)
sidStart = r.text.find("sid")+4
sid = r.text[sidStart:sidStart+32]
parameters = {'mode': 'login', 'sid': sid}
r = 
session.post("http://www.tt-forums.net/ucp.php",params=parameters,data=payload)
if "Logout" in r.text: print("We are in")

(for the record, I added the session creation line and replaced
requests. with session. so it uses your session.  This code was not
tested on a real phpBB forum; if everything you coded is correct, it
will work.)

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to turn a package into something pip can install

2014-02-16 Thread ChrisKwpolskaWarrick
On Sat, Feb 15, 2014 at 11:35 PM, Roy Smith  wrote:
> In article ,
>  Roy Smith  wrote:
>
>> > > $ pip install --no-index --quiet --find-links packages metar==1.4.0
>> > [snip]
>> > > ValueError: unknown url type: packages
>> >
>> > The path to your cache directory is incorrect.  I suggest using
>> > absolute paths (eg. /home/user/packages) instead of relative paths,
>> > which is likely what caused this issue.
>>
>> No, that's not it.  It doesn't work with an absolute path either.
>
> OK, I figured this out.  The on-line docs
> (http://www.pip-installer.org/en/latest/reference/pip_wheel.html) say
> you can give --find-links a path, but it looks like it insists on it
> being a valid URL.  If I prepend "file:" to the absolute path, it works.
>
> Maybe this is something which has changed in newer versions of pip?
> I've got 1.1 (and python 2.7.3).  I'm pretty sure both of these are what
> came with Ubuntu Precise.
> --
> https://mail.python.org/mailman/listinfo/python-list

It’s heavily outdated, and that IS the cause of your problem.  pip 1.5
accepts such paths just fine.  Please upgrade your pip.

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to turn a package into something pip can install

2014-02-15 Thread ChrisKwpolskaWarrick
On Sat, Feb 15, 2014 at 3:26 AM, Roy Smith  wrote:
> In article ,
>  Ryan Gonzalez  wrote:
>
>> python setup.py sdist
>
> OK, I run that and I get a metar-1.4.0.tar.gz under dist.  If I move
> that tarfile to my packages directory, and run pip, I get:
>
> $ pip install --no-index --quiet --find-links packages metar==1.4.0
[snip]
> ValueError: unknown url type: packages

The path to your cache directory is incorrect.  I suggest using
absolute paths (eg. /home/user/packages) instead of relative paths,
which is likely what caused this issue.

On Fri, Feb 14, 2014 at 7:47 PM, Roy Smith  wrote:
> What I can't figure out is what I need to do to go from a clone of the
> github repo to a tarball I can drop into our packages directory.  Is
> there some tutorial somewhere that explains this?

Actually, you could even tar up that entire repo (or even get a nice
ready tarball from GItHub) and you will get something usable with pip.
 For example, we in the Nikola project
(https://github.com/getnikola/nikola) upload the GitHub tarballs to
PyPI because we ship 99.9% of our tree anyways and hiring `setup.py
sdist` would be a waste of time (and would produce two
almost-identical-but-not-quite tarballs).

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: imperative mood in docstrings

2014-02-09 Thread ChrisKwpolskaWarrick
On Sun, Feb 9, 2014 at 5:52 PM, Roy Smith  wrote:
> In article ,
>  bagrat lazaryan  wrote:
>
>> pep 257 -- docstring conventions, as well as a myriad of books and other
>> resources, recommend documenting a function's or method's effect as a command
>> ("do this", "return that"), not as a description ("does this", "returns
>> that"). what's the logic behind this recommendation?
>>
>> bagratte
>
> Methods are verbs, and should be described as such.  If I had:
>
> class Sheep:
>def fly(self):
>   "Plummet to the ground."
>
> I'm defining the action the verb performs.  If, on the other hand, I had:
>
> class Sheep:
>def fly(self):
>   "Plummets to the ground"
>
> I'm no longer describing the action of flying, I'm describing what the
> sheep does when it attempts to perform that action.

This can also be seen with a (monolingual) dictionary.  For example:
https://www.google.com/search?q=define+fly (that’s actually from the
New Oxford American Dictionary):

fly, verb: 1. move through the air under control. 2. move or be hurled
quickly through the air.

Those could be valid docstrings (if sheep could fly, of course…) — so,
in other words, act as if you were writing a dictionary and not Python
code.

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Editor for Python

2014-01-08 Thread ChrisKwpolskaWarrick
On Wed, Jan 8, 2014 at 4:53 PM, Jean-Michel Pichavant
 wrote:
> I tried to negotiate this with my IT guys, but it looks like it's now 
> mandatory, something related to being in the USA stock market.
> I have no way to remove it, it's added by the email server. I apologise for 
> the noise.

But you have a way to hide it for people whose clients do support
that.  Simply, instead of signing your letters with “JM” yourself and
having your employer add this spam, simply have your mail client add
the sequence below as your signature.  Some clients offer adding the
separator automatically and you only have to type JM in the signature
field.

The “magical” sequence is: -- \nJM

(that is 0x2D 2D 20 0A 4A 4D, with a trailing space)


> JM
>
>
> -- IMPORTANT NOTICE:
>
> The contents of this email and any attachments are confidential and may also 
> be privileged. If you are not the intended recipient, please notify the 
> sender immediately and do not disclose the contents to any other person, use 
> it for any purpose, or store or copy the information in any medium. Thank you.
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Apache restart after source changes

2013-12-26 Thread ChrisKwpolskaWarrick
On Thu, Dec 26, 2013 at 7:36 AM, Fredrik Bertilsson  wrote:
>> Also, it's not a python issue, it's an issue with your particular
>> stack. Other stacks do automatic reloading (for example, the web
>> server that Django uses).
>
> Which web server do you suggest instead of Apache, which doesn't have this 
> problem? (I am not planning to use Django)
> --
> https://mail.python.org/mailman/listinfo/python-list

It depends.  Some other frameworks (like Flask) also offer auto-reload
in debug mode — auto-reload can be bad for you and is not supported by
production environments, in which uWSGI (in Emperor mode if
possible/makes sense on Windows) and nginx is the best solution
around, and auto-reload isn’t supported (for good reasons, as
mentioned before).
-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: unicode to human readable format

2013-12-22 Thread ChrisKwpolskaWarrick
On Sun, Dec 22, 2013 at 1:24 PM,   wrote:
> Hi,
> i'm looking for solution the unicode string translation to the more readable 
> format.
> I've got string like s=s=[u'\u0105\u017c\u0119\u0142\u0144'] and have no idea 
> how to change to the human readable format. please help!
>
> regards,
> tomasz
> --
> https://mail.python.org/mailman/listinfo/python-list

While printing the string, instead of the list/seeing the list’s repr,
Python shows a nice human-friendly representation.

>>> s=[u'\u0105\u017c\u0119\u0142\u0144']
>>> s
[u'\u0105\u017c\u0119\u0142\u0144']
>>> s[0]
u'\u0105\u017c\u0119\u0142\u0144'
>>> print s
[u'\u0105\u017c\u0119\u0142\u0144']
>>> print s[0]
ążęłń

However, that is only the case with Python 2, as Python 3 has a
human-friendly representation in the repr, too:

>>> s=[u'\u0105\u017c\u0119\u0142\u0144']
>>> s
['ążęłń']

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-15 Thread ChrisKwpolskaWarrick
On Sun, Dec 15, 2013 at 4:33 PM, Wolfgang Keller  wrote:
> And besides, again, a commercially licensed PyQt itself isn't *that*
> expensive.

> The cost of a commercial PyQt license for a single developer is £350
> (GBP). You may pay in either US Dollars, Euros or GBP.

(£420 incl. VAT for UK and select EU entities)

> one [license] per developer

For some people, it might be a lot.  Why waste money on something,
that has an almost-identical free-for-everyone version? (which also is
easier to install, BTW)

> PyQt does not include Qt itself. You must also obtain an
> appropriately licensed copy (either the commercial version from
> Digia or the LGPL version from the Qt Project).

So, you have four options:

a) use PySide and Qt@Project, pay $0 and be sane (albeit saner than
   person B);
b) use PyQt4 and Qt@Digia, pay £350/£420 + £??? and be sane;
c) use PySide and Qt@Digia, pay £??? and look like a hypocrite (albeit
   less than person D);
d) use PyQt4 and Qt@Project, pay £350/£420 and look like a hypocrite.

DISCLAIMER: Some things are based on assumptions, many of which may be
incorrect.

PS. For those living in the past without proper Unicode support: £ = GBP.

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Islam is the fastest growing religion in the world especially since sept. 11.

2013-12-13 Thread ChrisKwpolskaWarrick
 against America (at least most of them).
>>
>> In fact it was to the advantage of the Americans to make statements that
>> would help divide the Muslims over the situation existing in Afghanistan and
>> the situation that was sure to occur. By making this statement, he left the
>> door open for the Muslims who did not want to see any problem between the
>> materialism of the West (which they personally enjoyed or would like to
>> enjoy) and the sacrificing of those who were willing to stand up against the
>> tyranny and oppression of the Western society and all that comes along with
>> it.
>>
>> So the strategy was to say things that made certain Muslims look bad while
>> at the same time not exactly attacking Islam. This led up to the next
>> desirable situation for shaytan (the devil): Divide the Muslims against each
>> other. So, now we had "mainstream Muslims" and "fundamentalist Muslims" and
>> "terrorist Islam" and "modern Islam." It worked too. The Muslims did the
>> thing that the non-Muslims could never have done. The Muslims defeated
>> themselves. Anytime that Muslims fight Muslims and Muslims kill Muslims,
>> then Allah's Protection is lifted from them and they will loose. That is
>> what happened.
>>
>> People Want to Know
>>
>> Still in the midst of all of this negative propaganda and bad press,
>> non-Muslim people were curious to learn more of this "cult" of Islam, its
>> people and their beliefs. Books about Islam and Muslims were disappearing
>> off the shelves of the bookstores faster than they could replenish them.
>> Unfortunately almost every single book was written either by a non-Muslim or
>> authors from the various deviant sects of Muslims. So the people were still
>> not getting the real message of the true Islam.
>>
>> Websites, chat rooms, email and message boards became alive with
>> information (and misinformation) about Islam, Muslims, Quran, Muhammad,
>> peace be upon him. Some people wanted to know the truth, others wanted to
>> hide it. Discussions and arguments about what Islam is about and what
>> Muslims do were very common place. This was the most exposure that these
>> subjects had ever had in the world at one time.
>>
>>
>> Open Communication Between Muslim & Non-Muslim
>>
>> The good news came when the various dialogs between the Muslims and
>> Christians began to take place. When the non-Muslims began to enter the
>> masjids and sit with the Muslims and shared together in discussions and
>> shared together enjoying the food and traditions of other cultures an
>> amazing thing began to happen. They opened their minds and their hearts to
>> the true message of the submission and surrender and obedience to the One
>> True God, Allah -- in Islam.
>>
>> Back to Islam
>>
>> Since September 11th, I have seen a huge increase in the interest of
>> people wanting to know about Islam and at the same time a marked increase in
>> the "dawah" (invitation) to Islam on the part of the Muslims around the
>> world. This is how the people are coming to Islam. The same way people have
>> come to Islam for 1,400 years. By learning the true message and being with
>> real Muslims. Those who are inclined to "revert" back to the natural state
>> of baby-like submission and peace with Allah, are finding their way back to
>> Islam.
>>
>>
>> Many New Muslims
>>
>> Islam today, is growing faster than ever. It is the Will of Allah, for
>> only He Guides. The people want to know. The interest is keen. The materials
>> are available in more simple terms in many languages. The Muslims are
>> starting to carry the responsibility of sharing the message of the true
>> "Peace With God in Islam."
>>
>> Islam In Every Home
>>
>> Somewhere in the middle of all of this is occurred to me an expression of
>> our prophet Muhammad, peace be upon him. When he said what might translate
>> to English as:
>>
>> "The Last Day will not come until Islam has entered every house on earth,
>> whether it is made of animal skins or from the earth."
>>
>>
>> http://www.islamhouse.com/185804/en/en/articles/Islam_is_the_fastest_growing_religion_in_the_world_especially_since_sept._11.
>>
>> http://www.islamtomorrow.com
>>
>> thank you
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is It Bug?

2013-12-08 Thread ChrisKwpolskaWarrick
On Sun, Dec 8, 2013 at 2:22 AM, Roy Smith  wrote:
> There's nothing you can do with raw strings that you can't do with
> regular strings, but they're easier to read when you start to use
> backslashes.

Unfortunately, there is one.  A raw string cannot end with a backslash.

>>> r'a\a'
'a\\a'
>>> r'a\'
  File "", line 1
r'a\'
^
SyntaxError: EOL while scanning string literal
>>> r'\'
  File "", line 1
r'\'
   ^
SyntaxError: EOL while scanning string literal

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: SetupTools

2013-11-25 Thread ChrisKwpolskaWarrick
On Mon, Nov 25, 2013 at 9:35 AM, Chandru Rajendran
 wrote:
>
> Hi all,
> How can we set the target folder for the package in Setuptools?

The answer likely is *you are not allowed to do this*.  It’s up to the
user to set it.

Unless you are the user, and want to have the packages you install go
to a place desired by you, then the --prefix parameter may be of help
(although you are better off by using a virtualenv which makes it
unnecessary)

>  CAUTION - Disclaimer *
> [snip]
> ***INFOSYS End of Disclaimer INFOSYS***


Tell your legal department that such notices have no legal power
whatsoever and are just a waste of everyone’s bandwidth, time and the
like.

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Terry Jones: "Monty Python to reunite for stage show"

2013-11-19 Thread ChrisKwpolskaWarrick
On Tue, Nov 19, 2013 at 3:08 PM, Thomas Heller  wrote:
> "All of the surviving members of comedy group Monty Python are to reform for
> a stage show, one of the Pythons, Terry Jones, has confirmed."
>
> See: http://www.bbc.co.uk/news/entertainment-arts-24999401
>
> Thomas
> --
> https://mail.python.org/mailman/listinfo/python-list

The PSF should buy all the tickets and give them out to Python devs.
Or even invite the group to PyCon 2014.

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Self-defence

2013-11-17 Thread ChrisKwpolskaWarrick
On Sun, Nov 17, 2013 at 6:09 PM, Zero Piraeus  wrote:
> :
>
> Note: I drafted a version of this post earlier today. I had been waiting
> to see whether Nikos succeeded in baiting the list into yet another
> round of unpleasantness before sending it, because I didn't want to
> worsen the situation, but at this point things are completely out of
> hand, and even what looks like a consensus attempt to ignore Nikos out
> of existence is
>
> a) failing: I count eighteen emails so far today.
>
> b) going to lead casual visitors to assume either that we ignore
> requests for help or that the list is Nikos' personal echo chamber.
>
> At this point I consider Nikos' actions a conscious attack on the list.
> There is simply no way, after the many times he's been told not to
> repost, that this is anything other than a direct and deliberate attempt
> to annoy as many people as he can.
>
> That being the case, I'd like to know whether there are technical
> measures that can be taken to prevent him from posting here.
>
> I understand that the mail/news gateway might complicate that, and that
> any measures taken could be bypassed by someone with sufficient skill. I
> suspect that in this particular case the latter issue is less relevant
> than it might otherwise be.
>
> I don't believe that killfiles are a sufficient response in this
> situation.
>
> I can, of course, stop Nikos' posts reaching me, and without too much
> hassle also stop replies to his posts reaching me. He would, however,
> continue to pollute the list in public, and his posts, whether replied
> to or not at the volume he's now sending them, would continue to damage
> the reputation of the list and, ultimately, I think possibly kill it.

We could report abuse to his server, eternal-september.org[0].  I
tried to do this, but they wanted fancy usenetty headers, and I am not
equipped to get them.

Now, we can try reporting for (a) abusive trolling; (b) excessive
morphing for killfile evasion (my original attempted report); (c) spam
(if I understand the Breidbart Index correctly, we might have to wait
for this, at least two emails to be precise)

[0]: http://www.eternal-september.org/index.php?showpage=abuse

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Static Website Generator

2013-11-16 Thread ChrisKwpolskaWarrick
On Nov 16, 2013 3:45 PM, "Silvio Siefke"  wrote:
>
> Hello,
>
> i want try a static Website Generator. Has someone an advice for a simple
> and easy System to use? I want run my blog with it, so the system should
> run with my design of Website.
>
> I has try Pelican, but its i dont know that themeing make me crazy.

I love (full disclosure: and co-develop) Nikola — http://getnikola.com/

Theming Nikola is not hard, takes a few minutes tops.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Odd msg received from list

2013-11-15 Thread ChrisKwpolskaWarrick
On Fri, Nov 15, 2013 at 12:30 AM, Gregory Ewing
 wrote:
> Verde Denim wrote:
>>
>> The message also listed my
>> account password, which I found odd.
>
>
> You mean the message contained your actual password,
> in plain text? That's not just odd, it's rather worrying
> for at least two reasons. First, what business does a
> message like that have carrying a password, and second,
> it means the server must be keeping passwords in a
> readable form somewhere, which is a really bad idea.

From the info page at https://mail.python.org/mailman/listinfo/python-list:

> You may enter a privacy password below. This provides only mild
> security, but should prevent others from messing with your
> subscription. **Do not use a valuable password** as it will
> occasionally be emailed back to you in cleartext.

> If you choose not to enter a password, one will be automatically
> generated for you, and it will be sent to you once you've confirmed
> your subscription.  You can always request a mail-back of your
> password when you edit your personal options. Once a month, your
> password will be emailed to you as a reminder.

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Trying tcompile an use the Python 3.4a

2013-11-13 Thread ChrisKwpolskaWarrick
On Wed, Nov 13, 2013 at 5:38 PM, Ferrous Cranus  wrote:
> Στις 13/11/2013 6:13 μμ, ο/η Steven D'Aprano έγραψε:
>
>
>>> and also is there a way to call it like #!/usr/bin/python
>>
>>
>> Of course there is, but only if you wish to break your system. The OS
>> will be expecting /usr/bin/python to be Python 2. Leave it be.
>
>
> Okey i will leave it be although i dislike the idea of using the shebang
> constructor as #~/usr/local/bin/python3
> Is there any way that i can use it as it was #!/usr/bin/python but firing
> python3 instead of python 2.6.6 ?

You can link it to /usr/bin/python3.  There should be no problem when
you do this.

> Also i'm tryong 'yum install python-pip' because some modules like 'pymysql'
> and 'pygeoip' are missing but CentOS doesn't seem able to detect it.

That should install it for the Python 2.6.6 you have, and possibly
under the name `python-pip` because of various shenanigans in the
redhatesque repos.

> Please help me install 'pip' so i can install the modules.

http://www.pip-installer.org/en/latest/installing.html#install-or-upgrade-setuptools

Get ez_setup.py and get-pip.py, and run them with the desired Python.

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Trying tcompile an use the Python 3.4a

2013-11-13 Thread ChrisKwpolskaWarrick
On Wed, Nov 13, 2013 at 3:17 PM, Ferrous Cranus  wrote:
> $ mkdir temp
> $ cd temp
> $ wget http://www.python.org/ftp/python/3.4/Python-3.4.tar.bz2
> $ tar -xjvf Python-3.4.tar.bz2
> $ cd Python-3.3.2
> $ ./configure
> $ make && make test
> $ su
> # make install
> # exit
> $ $ cd ../ && rm -rf Python-3.4
>
>
> root@secure [/home/nikos/www/cgi-bin]# python3 -V
> Python 3.4.0a4
>
>
> can yu please tell me where python 3.4a was placed in the system?
>
> i tried
>
> #!/usr/bin/python3
> #!/usr/local/bin/python3
>
> and also is there a way to call it like #!/usr/bin/python
>
> i know it can be done via ln 0s but i have to know where the newest python
> got installed.
>
> Thank you.
> --
> https://mail.python.org/mailman/listinfo/python-list

The command you are looking for is: which python3
Alternatively, you could run `where python3` to see how big the mess
on your system is (i.e. how many interpreters you have).

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Install Tkinter for Windows 7 64-bit

2013-11-11 Thread ChrisKwpolskaWarrick
On Mon, Nov 11, 2013 at 5:38 PM,   wrote:
> But i have no luck runn the Tkinter example file i downloaded in idel, it 
> still says no module called Tkinter.
IDLE*
> ===
> Traceback (most recent call last):
>   File "D:\Python33\test2.py", line 16, in 
> from Tkinter import Tk, Canvas, Frame, BOTH
> ImportError: No module named 'Tkinter'
> ===

In Python 3, 'Tkinter' was renamed to 'tkinter' (both sans quotes).
Please change the file to reflect that (as the traceback points out,
line 16).

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: To whoever hacked into my Database

2013-11-10 Thread ChrisKwpolskaWarrick
On Nov 10, 2013 9:01 PM, "Rod Person"  wrote:
> Tortoise? What's a tortoise?
Is that a real question? If yes, then it's an animal, similar to a turtle.
Ask Google or Wikipedia for more details.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Immediate requirement - Sr. Business Analyst for Pricewaterhouse Coopers (PwC) in Tampa, FL.

2013-11-07 Thread ChrisKwpolskaWarrick
On Thu, Nov 7, 2013 at 8:45 PM,   wrote:
> Hi,
>
> Immediate requirement - Sr. Business Analyst for Pricewaterhouse Coopers 
> (PwC) in Tampa, FL.
> [snip]
> https://mail.python.org/mailman/listinfo/python-list

This is a Python list.  You ARE NOT hiring Python programmers.
Moreover, this list/newsgroup IS NOT the valid place for job offers,
Python or otherwise.  Please stop sending them.

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: To whoever hacked into my Database

2013-11-07 Thread ChrisKwpolskaWarrick
On Thu, Nov 7, 2013 at 3:58 PM, Neil Cerutti  wrote:
> On 2013-11-07, Chris Angelico  wrote:
>> (Please don't start your text with a double-hyphen - that's a common
>> convention for the start of your signature, and many people and UAs
>> will ignore text after it.)
>
> It's '-- ', with a space after, to be precise.

To be even more precise, it’s those three characters on a line all by itself.

> But I like it the way he's doing it! His messages are greatly
> improved from where I'm sitting..

Gmail automatically hides all longer quotes (Google Groups does the
same, so they don’t get to see their double-spaced nonsense) AS WELL
AS signatures.  Well, world couldn’t be more wonderful than Nikos
posting nothing.

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Basic Python Questions - Oct. 31, 2013

2013-10-31 Thread ChrisKwpolskaWarrick
On Thu, Oct 31, 2013 at 11:38 AM, E.D.G.  wrote:
> Posted by E.D.G. October 31, 2013

no need to write that.

>
> Hi Chris,
>
>   Thanks for the responses. Several of my questions were answered.
>
>   The calculation speed question just involves relatively simple math
> such as multiplications and divisions and trig calculations such as sin and
> tan etc. Presently I am using Perl to do those types of calculations. And I
> am starting to run into problems with how long it takes Perl to do thousands
> and even millions of calculations like that even though they are relatively
> simple.

I suggest that you try Python out yourself, on your data.  I can’t

>   The version of Perl that I am presently using has the usual Print
> statements for printing to the Perl program window.  It sends Windows
> programs or files information in the following manner:
>
> Win32::GuiTest::SendKeys("The text within these two parentheses marks will
> print as text in an active Notepad window.");
>
>   It would be my guess that Python has some type of statement like that.
>

Looks like you want something like [0] (requires pywin32 from [1]).

[0]: http://win32com.goermezer.de/content/view/136/254/
[1]: http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Basic Python Questions - Oct. 31, 2013

2013-10-31 Thread ChrisKwpolskaWarrick
On Thu, Oct 31, 2013 at 10:31 AM, E.D.G.  wrote:
> Posted by E.D.G. on October 31, 2013
>
>   The following are several relatively basic questions regarding
> Python's capabilities.  I am not presently using it myself.  At the moment a
> number of people including myself are comparing it with other programs such
> as XBasic for possible use.
>
> 1.  How fast can Python do math calculations compared with other languages
> such as Fortran and fast versions of Basic.  I would have to believe that it
> is much faster than Perl for doing math calculations.

Depends on what do you want to calculate.  Also, note that Python is
liked by the scientific community to use for calculations.  This might
be a hint.

> 2.  Can Python be used to create CGI programs?  These are the ones that run
> on Internet server computers and process data submitted through Web site
> data entry screens etc.  I know that Perl CGI programs will do that.

Yes.  Although most people in the Python community dislike the
old-style “CGI” and use “web apps” instead.  They are also connected
with a different philosophy, for example we do not store .py files in
/cgi-bin/, we never expose our .py files and put it somewhere else on
the system and let the web server act as a proxy to a WSGI server
(gunicorn/uwsgi).

> 3.  If Python can be used for CGI programming, can it draw charts such as
> .png files that will then display on Web pages at a Web site?

Yes, but you need to install additional libraries for that.

> 4.  How well does Python work for interactive programming.  For example, if
> a Python program is running on a PC and is drawing a chart, can that chart
> be modified by simply pressing a key while the Python program is running.  I
> have Perl and Gnuplot program combinations that can do that.  Their
> interactive speed is not that great.  But it is adequate for my own uses.

Doable, but I cannot give you any information on the speed.

> 5.  Can a running Python program send information to the Windows operating
> system as if it were typed in from the keyboard?  Perl can do that and I
> would imagine that Python probably has that same capability.

Definitely possible, but might take you a bit of work and knowledge of
Windows internals (go ask Google).

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: indentation blocking in Python

2013-10-27 Thread ChrisKwpolskaWarrick
On Sun, Oct 27, 2013 at 4:31 PM,   wrote:
> hello all,
>
> This has got me a tad bit confused I think.  I am running 3.3.0 and I know 
> that Python looks to group code together that is supposed to be in the same 
> block.  But the question is, where are the rules for this?  For instance, if 
> I type the following in a PY file, it errors out and I don't see the DOS 
> window with the output in Vista:

It’s called the command prompt.
> a=1;
>if a==1: print(1)
>else: print(0)
> wait = input("press key")
>
> However, if I don't indent anything at all, it works!
>
> a=1;
> if a==1: print(1)
> else: print(0)
> wait = input("press key")

You indented the wrong thing.  You put your if/else statement in a
non-standard way (which works, but is discouraged).  Also, you ended
the first line with a semicolon (same case).  So, the proper code
would be:

a=1
if a==1:
print(1)
else:
print(0)
wait = input("press key")

(I resisted the urge to add spaces around `=` and `==`, something most
people want you to do.)

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: OT: looking for best solutions for tracking projects and skills

2013-10-13 Thread ChrisKwpolskaWarrick
On Sun, Oct 13, 2013 at 8:40 PM, Jason Friedman  wrote:
> I highly recommend JIRA, free for non-profit use:
> https://www.atlassian.com/software/jira.

As usual, the free version is hidden and available only on request:
https://www.atlassian.com/software/views/open-source-license-request

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to make Tkinter Listbox entry insensitive?

2013-10-10 Thread ChrisKwpolskaWarrick
On Thu, Oct 10, 2013 at 4:37 PM, Skip Montanaro  wrote:
> Thanks. "disabled" did the trick. Turns out you can't disable
> individual items. Instead, you have to (hackishly) change the display
> of entries somehow to indicate their inappropriateness...

Removing inappropriate entries is not much of a hack.

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Mysql's mysql module

2013-10-07 Thread ChrisKwpolskaWarrick
On Oct 7, 2013 9:36 PM, "Duncan Booth"  wrote:
>
> Skip Montanaro  wrote:
>
> > On Mon, Oct 7, 2013 at 1:08 PM, Tobiah  wrote:
> >> I just noticed this:
> >>
> >>
> >> http://dev.mysql.com/doc/connector-python/en/index.html
> >
> > * Does it adhere to the Python database API?
> > http://www.python.org/dev/peps/pep-0249/
> >
> > * Is source available?
> >
> > * Does it have a reasonable open source license?
> >
> > These questions come immediately to mind because at work we briefly
> > considered, then rejected, a similar offering from the Sybase folks
> > for connecting to (big surprise) Sybase. We never needed to ask the
> > first and third questions, because the answer to the second was, "no",
> > and they only offered a version built against Python 2.6. Since we use
> > Python 2.4 and 2.7, that was an immediate nonstarter.
> >
> > Skip
>
> Based on a quick look at the link given, I think the answers to questions
1
> and 3 are yes and no respectively. No idea about #2.

Number two is "yes", unless there are deceptive statements on that page.
>
> --
> Duncan Booth http://kupuguy.blogspot.com
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Image manipulation

2013-10-06 Thread ChrisKwpolskaWarrick
On Sun, Oct 6, 2013 at 3:19 PM,   wrote:
> Image consists of pixels. Each pixel has its RGBA values. In python whidout 
> any extra downloadable modules, is there a way to get those values. I know 
> PIG has it but i hav Python 3.3.2 so PIG wont do.

PIG?  Did you mean PIL?  In that case, go use Pillow, the Python
3-compatible fork.
-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Database statements via python but database left intact

2013-10-06 Thread ChrisKwpolskaWarrick
On Sun, Oct 6, 2013 at 1:36 PM, rusi  wrote:
> On Sunday, October 6, 2013 2:35:24 PM UTC+5:30, Chris “Kwpolska” Warrick 
> wrote:
>> So, instead of this, maybe we should work on getting psycopg2 to the
>> top result on Googling “python sql”, or even “python mysql” with an
>> anti-MySQL ad? (like vim was doing some time ago on Googling “emacs”)
>
> Do you have any accessible data about this?
> Reasons I ask:
> 1. The decreasing popularity of emacs wrt vi seems out of proportion to the 
> actual functionality
> 2. The downward emacs-curve is all the more striking considering the reverse 
> situation some 15-20 years ago

I have a screenshot:
https://dl.dropboxusercontent.com/u/1933476/screenshots/emacs.png —
Dropbox claims it was taken at around 2011-03-19T11:32:24Z.  Earlier
today, the exact same ad appeared while searching for “vim”, but not
“emacs” (why bother when you are the first hit for this query
anyways?).

Now, for statistics, how many hits it got, or whatnot — go ask the Vim
developers.

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Database engine bindings for Python (was: Database statements via python but database left intact)

2013-10-06 Thread ChrisKwpolskaWarrick
Reposting what I said in the other thread:

On Sun, Oct 6, 2013 at 12:51 AM, Chris Angelico  wrote:
> On Sun, Oct 6, 2013 at 8:39 AM, Ned Batchelder  wrote:
>> Now is a good time to go read about transactions, and committing, and the
>> difference between MyISAM and InnoDB.  Please don't ask more about it here.
>
> It's because of threads like this that I would really like Python to
> nudge people towards something stronger than MySQL. Would it kill
> Python to incorporate PostgreSQL bindings automatically?

It would require Postgres around people’s (or at least packagers’)
systems, and it often gets messy when we have such requirements.
Psycopg2, the most popular binding, is licensed under LGPL3 + Zope (or
such, there is a little mess here) which MAY pose a problem (IANAL
though).  Also, Postgres is much harder to configure than MySQL,
especially if you have no experience or an asshole OS.  Moreover, the
stdlib is where packages come to die.

So, instead of this, maybe we should work on getting psycopg2 to the
top result on Googling “python sql”, or even “python mysql” with an
anti-MySQL ad? (like vim was doing some time ago on Googling “emacs”)

We should also educate people on how PostgreSQL works with a nice,
human-friendly tutorial.  Especially in some non-standard things and
things that differ between PostgreSQL and MySQL — like how to make an
auto-incrementing ID field (use sequences), or how PostgreSQL arrays
work, among others.  The wiki (that nobody reads anyways) could also
use some marketing fixes.

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Database statements via python but database left intact

2013-10-06 Thread ChrisKwpolskaWarrick
On Sun, Oct 6, 2013 at 12:51 AM, Chris Angelico  wrote:
> On Sun, Oct 6, 2013 at 8:39 AM, Ned Batchelder  wrote:
>> Now is a good time to go read about transactions, and committing, and the
>> difference between MyISAM and InnoDB.  Please don't ask more about it here.
>
> It's because of threads like this that I would really like Python to
> nudge people towards something stronger than MySQL. Would it kill
> Python to incorporate PostgreSQL bindings automatically?

It would require Postgres around people’s (or at least packagers’)
systems, and it often gets messy when we have such requirements.
Psycopg2, the most popular binding, is licensed under LGPL3 + Zope (or
such, there is a little mess here) which MAY pose a problem (IANAL
though).  Also, Postgres is much harder to configure than MySQL,
especially if you have no experience or an asshole OS.  Moreover, the
stdlib is where packages come to die.

So, instead of this, maybe we should work on getting psycopg2 to the
top result on Googling “python sql”, or even “python mysql” with an
anti-MySQL ad? (like vim was doing some time ago on Googling “emacs”)

We should also educate people on how PostgreSQL works with a nice,
human-friendly tutorial.  Especially in some non-standard things and
things that differ between PostgreSQL and MySQL — like how to make an
auto-incrementing ID field (use sequences), or how PostgreSQL arrays
work, among others.  The wiki (that nobody reads anyways) could also
use some marketing fixes.

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread ChrisKwpolskaWarrick
On Wed, Oct 2, 2013 at 1:48 AM, Tim Delaney  wrote:
> On 2 October 2013 09:28, Νίκος  wrote:
>>
>>
>> con = pymysql.connect( db = 'mypass', user = 'myuser', passwd =
>> 'mysqlpass', charset = 'utf8', host = 'localhost' )
>>
>> That was viewable by the link Mark have posted.
>>
>> But this wasnt my personal's account's login password, that was just the
>> mysql password.
>>
>> Mysql pass != account's password
>
>
> Because there's no chance with the brilliance you display that there could
> be any possibility of login details being kept in plaintext in your
> database.

Or the statement is a blatant lie and was meant to be

mysql_password is not account_password

as they have the same value, but are set independently.  (too much Python Ale…)

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Fwd: JUST GOT HACKED

2013-10-01 Thread ChrisKwpolskaWarrick
Why is this list not setting Reply-To correctly again?

-- Forwarded message --
From: Chris “Kwpolska” Warrick 
Date: Tue, Oct 1, 2013 at 3:55 PM
Subject: Re: JUST GOT HACKED
To: Νίκος 


On Tue, Oct 1, 2013 at 3:42 PM, Νίκος  wrote:
> Στις 1/10/2013 4:27 μμ, ο/η Chris “Kwpolska” Warrick έγραψε:
>>
>> On Tue, Oct 1, 2013 at 3:15 PM, Νίκος  wrote:
>>>
>>> Στις 1/10/2013 4:06 μμ, ο/η Mark Lawrence έγραψε:
>>>>
>>>>
>>>> On 01/10/2013 10:58, Νίκος wrote:
>>>>>
>>>>>
>>>>> Just logged in via FTP to my server and i saw an uploade file named
>>>>> "Warnign html"
>>>>>
>>>>> Contents were:
>>>>>
>>>>> WARNING
>>>>>
>>>>> I am incompetent. Do not hire me!
>>>>>
>>>>> Question:
>>>>>
>>>>> WHO AND MOST IMPORTNTANLY HOW DID HE MANAGED TO UPLOAD THIS FILE ON MY
>>>>> ACCOUNT?
>>>>>
>>>>> PLEASE ANSWER ME, I WONT GET MAD, BUT THIS IS AN IMPORTANT SECURITY
>>>>> RISK.
>>>>>
>>>>> SOMEONES MUST HAVE ACCESS TO MY ACCOUNT, DOES THE SOURCE CODE OF MY
>>>>> MAIN
>>>>> PYTHON SCRIPT APPEARS SOMEPLACE AGAIN?!?!
>>>>
>>>>
>>>>
>>>> Would you please stop posting, I've almost burst my stomach laughing at
>>>> this.  You definetely have a ready made career writing comedy.
>>>
>>>
>>>
>>> Okey smartass,
>>>
>>> Try to do it again, if you be successfull again i'll even congratulate
>>> you
>>> myself.
>>>
>>> --
>>> https://mail.python.org/mailman/listinfo/python-list
>>
>>
>> It looks like you are accusing someone of doing something without any
>> proof whatsoever.  Would you like help with the fallout of the lawsuit
>> that I hope Mark might (should!) come up with?i'am
>>
>>
>> Speaking of “try again”, I doubt it would be hard…  As long as a FTP
>> daemon is running somewhere (and you clearly do not know better); or
>> even you have a SSH daemon and you do not know better, an attacker
>> can:
>>
>> a) wait for you to publish your password yet again;
>> b) get you to download an exploit/keylogger/whatever;
>> c) brute-force.
>>
>> Well, considering it’s unlikely you actually have a long-as-shit
>> password, (c) is the best option.  Unless your password is very long,
>> in which case is not.
>>
>> I’m also wondering what language your password is in.  If you actually
>> used a Greek phrase, how long will it take you to get locked out due
>> to encoding bullshit?
>
>
> Like i use grek letter for my passwords

Did you know that you just lowered the amount of characters an
attacker should check while brute-forcing your password from 256/164
(UTF-*/ISO-8859-7) to just 95?  No?  Congratulations anyways, Nikos!

--
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense


-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-01 Thread ChrisKwpolskaWarrick
On Tue, Oct 1, 2013 at 3:15 PM, Νίκος  wrote:
> Στις 1/10/2013 4:06 μμ, ο/η Mark Lawrence έγραψε:
>>
>> On 01/10/2013 10:58, Νίκος wrote:
>>>
>>> Just logged in via FTP to my server and i saw an uploade file named
>>> "Warnign html"
>>>
>>> Contents were:
>>>
>>> WARNING
>>>
>>> I am incompetent. Do not hire me!
>>>
>>> Question:
>>>
>>> WHO AND MOST IMPORTNTANLY HOW DID HE MANAGED TO UPLOAD THIS FILE ON MY
>>> ACCOUNT?
>>>
>>> PLEASE ANSWER ME, I WONT GET MAD, BUT THIS IS AN IMPORTANT SECURITY RISK.
>>>
>>> SOMEONES MUST HAVE ACCESS TO MY ACCOUNT, DOES THE SOURCE CODE OF MY MAIN
>>> PYTHON SCRIPT APPEARS SOMEPLACE AGAIN?!?!
>>
>>
>> Would you please stop posting, I've almost burst my stomach laughing at
>> this.  You definetely have a ready made career writing comedy.
>
>
> Okey smartass,
>
> Try to do it again, if you be successfull again i'll even congratulate you
> myself.
>
> --
> https://mail.python.org/mailman/listinfo/python-list

It looks like you are accusing someone of doing something without any
proof whatsoever.  Would you like help with the fallout of the lawsuit
that I hope Mark might (should!) come up with?

Speaking of “try again”, I doubt it would be hard…  As long as a FTP
daemon is running somewhere (and you clearly do not know better); or
even you have a SSH daemon and you do not know better, an attacker
can:

a) wait for you to publish your password yet again;
b) get you to download an exploit/keylogger/whatever;
c) brute-force.

Well, considering it’s unlikely you actually have a long-as-shit
password, (c) is the best option.  Unless your password is very long,
in which case is not.

I’m also wondering what language your password is in.  If you actually
used a Greek phrase, how long will it take you to get locked out due
to encoding bullshit?

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte

2013-09-29 Thread ChrisKwpolskaWarrick
On Sun, Sep 29, 2013 at 1:51 PM, Νίκος  wrote:
> Στις 29/9/2013 2:46 μμ, ο/η Dave Angel έγραψε:
>>
>> On 29/9/2013 07:25, Νίκος wrote:
>>
>>
>>>
>>> Thank you for being willing to look this further.
>>
>>
>> Willing, but probably not able.  I think I know a lot about the
>> language, and less about the libraries.  I know very little about the
>> administration side of internet use. The reference to /etc/hosts is
>> only a guess, as I said.
>>
>>
>>
>>
> Can you please point me to a direction that someone will be able to help me
> with this since the provider doesn't care to do so?

I can point you to “find a sysadmin that will work for you and fix
your problems for money”.  Where can you find one?  That’s not a
question for me.  I suggest looking around Greek websites, as someone
speaking the same language as you could help you better.

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Referrer key missing form os.environ dictionary?

2013-09-25 Thread ChrisKwpolskaWarrick
On Wed, Sep 25, 2013 at 2:45 PM, Νίκος  wrote:
> Hello, i decided am ong other os.environ variables to also grab the
> 'HTTP_REFERER' fiel but when i try to run my script i was seeing a KeyError
> complaining that 'HTTP_REFERER' didnt exist.
>
> So, to see what existed in the os.environ dictionary i issues a print(
> os.environ ) to see all available keys and their values:

The Referer header is not mandatory by any means.  Your client
probably does not send it.

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to login to a website using Python 3.x?

2013-09-25 Thread ChrisKwpolskaWarrick
On Tue, Sep 24, 2013 at 10:39 AM, Mark Lawrence  wrote:
> On 24/09/2013 09:09, Osumo Clement wrote:
>>
>>   Hi. I am new to Python. I am making a script where logging in to a
>> website is the first step.. I am using Python 3.3 All of the help I have
>> seen online uses urllib2 which in Python 3 aint there. I will greatly
>> appreciate any help
>>
>
> urllib2 has been renamed in Python 3 see
> http://www.python.org/dev/peps/pep-3108/#urllib-package

Note that, for sanity, you should use <http://python-requests.org/> (a
third-party package) instead.

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: In Python language, what is (void) referring to?

2013-09-21 Thread ChrisKwpolskaWarrick
On Sat, Sep 21, 2013 at 11:10 AM, Don Sylvia  wrote:
> void...?
> --
> https://mail.python.org/mailman/listinfo/python-list

void does not exist in Python, unless you named a variable “void”.  In
that case, it means whatever you set it to.

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to display ReST properly on pypi?

2013-09-14 Thread ChrisKwpolskaWarrick
On Sat, Sep 14, 2013 at 11:08 AM, Michel Albert  wrote:
> In general, I write my README files using the ReST syntax. But when I do, 
> they don't show up formatted on pypi (see for example 
> https://pypi.python.org/pypi/config_resolver/3.3.0).
>
> How do I get it to be formatted properly?
>
> Also, is there a way to specify that the "description" field in setup.py is 
> formatted as ReST?
> --
> https://mail.python.org/mailman/listinfo/python-list

rst2html crashes with your file.  Also, `py:class` is Sphinx-only and
won’t work with the Cheeseshop and produce garbage in the output.

[kwpolska@kwpolska-lin config_resolver-3.3.0]% rst2html README.rst
README.rst:67: (WARNING/2) Inline emphasis start-string without end-string.
README.rst:108: (ERROR/3) Unknown interpreted text role "py:class".
README.rst:115: (ERROR/3) Unknown interpreted text role "py:class".
README.rst:121: (ERROR/3) Unknown interpreted text role "py:class".
README.rst:142: (SEVERE/4) Problems with "include" directive path:
InputError: [Errno 2] No such file or directory: 'CHANGES'.
Exiting due to level-4 (SEVERE) system message.
[kwpolska@kwpolska-lin config_resolver-3.3.0]% echo $?
1
[kwpolska@kwpolska-lin config_resolver-3.3.0]%

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How can I remove the first line of a multi-line string?

2013-09-02 Thread ChrisKwpolskaWarrick
On Mon, Sep 2, 2013 at 6:06 PM, Anthony Papillion  wrote:
> Hello Everyone,
>
> I have a multi-line string and I need to remove the very first line from
> it. How can I do that? I looked at StringIO but I can't seem to figure
> out how to properly use it to remove the first line. Basically, I want
> to toss the first line but keep everything else.  Can anyone put me on
> the right path? I know it is probably easy but I'm still learning Python
> and don't have all the string functions down yet.
>
> Thanks,
> Anthony
> --
> http://mail.python.org/mailman/listinfo/python-list

Use split() and join() methods of strings, along with slicing.  Like this:

fullstring = """foo
bar
baz"""

sansfirstline = '\n'.join(fullstring.split('\n')[1:])

The last line does this:
1. fullstring.split('\n') turns it into a list of ['foo', 'bar', 'baz']
2. the [1:] slice removes the first element, making it ['bar', 'baz']
3. Finally, '\n'.join() turns the list into a string separated by
newlines ("""bar
baz""")

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What does mean @ sign in first of statement

2013-09-01 Thread ChrisKwpolskaWarrick
On Sun, Sep 1, 2013 at 8:53 PM, Mohsen Pahlevanzadeh
 wrote:
> Dear all,
>
> What does mean @ sign in first of statement such as:
>
> //
> @hybrid_property
> def fullname(self):
> return self.firstname + " " + self.lastname
> ///
>
> Sorry for cheap question.
>
> Yours,
> Mohsen
>
> --
> http://mail.python.org/mailman/listinfo/python-list

@hybrid_property is a decorator.  Great resource:
http://simeonfranklin.com/blog/2012/jul/1/python-decorators-in-12-steps/

--
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie: use of built-in exceptions

2013-09-01 Thread ChrisKwpolskaWarrick
On Sun, Sep 1, 2013 at 1:17 PM, Rui Maciel  wrote:
> Are there any guidelines on the use (and abuse) of Python's built-in 
> exceptions, telling where
> it's ok to raise them and where it's preferable to define custom exceptions 
> instead?

There are no rules.  You should use common sense instead: if the
exception fits your needs (eg. ValueError when incorrect output
occurs) then use it.

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Moving to Python for web

2013-08-29 Thread ChrisKwpolskaWarrick
On Thu, Aug 29, 2013 at 2:45 PM, Andreas Ecaz  wrote:
> I've decided to go with Flask! It's now running on UWSGI with NGINX. 
> Hopefully I can get some stuff done :)

How are you running uWSGI?  On sane (non-Windows) OSes, I recommend
using the uWSGI Emperor, which will protect you from your website
going down when something crashes.  You run the Emperor through your
OS’s init system (e.g. upstart in Ubuntu, systemd in many others).

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Moving to Python for web

2013-08-29 Thread ChrisKwpolskaWarrick
On Thu, Aug 29, 2013 at 4:18 AM, Sam Fourman Jr.  wrote:
> there are MANY micro frameworks, I have been following these guys for a few
> years
> http://www.pocoo.org/

+1.  The Pocoo team makes many awesome things.

> specifically jinja2 and flask looks to be the best choice out of all the
> options out there

Jinja2 is a standalone templating engine, something like Smarty for
PHP.  And Flask is a microframework, which adds on top of Jinja2 (not
mandatory) and Werkzeug (another Pocoo project) to make a nice and
easy webdevelopment base.  IMO it is the best choice in terms of
microframeworks.

But microframeworks are, as the name states, micro.  The big
frameworks include tons of abstractions and fancy features.  Some
people may like them, others may not.  (Those features can obviously
be implemented in the microframeworks on one’s own or through existing
open-source code.)

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
http://mail.python.org/mailman/listinfo/python-list


  1   2   >