Re: [Tutor] Recommended Python Compiler

2017-07-31 Thread Stefan Behnel
Ben Finney schrieb am 31.07.2017 um 04:24:
> You might be looking for a different compiler, maybe one which compiles
> not to Python byte code but instead to CPU machine code. There isn't
> such a thing;

The Python wiki lists several compilers for Python, although with varying
levels of language compliance and/or code compatibility*:

https://wiki.python.org/moin/PythonImplementations#Compilers

The most widely used static Python compiler is probably still Cython.

Stefan
(Cython core developer)


PS*: being compliant with the Python language does not necessarily mean it
can successfully run your existing code, as that also requires access to
third-party dependencies etc. Not all tools (aim to) provide that.

PPS: it seems that wiki list needs an update as a) many of the links did
not survive the termination of and migration away from Google Code and b)
some of the projects should now better be marked as abandoned.

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Recommended Python Compiler

2017-07-31 Thread Abdur-Rahmaan Janhangeer
can i recommend you wing ide personal edition?

a breeze.

p.s. an ide cares about helping you coping with errors, syntax highlighting
and ironing out some corners here and there

a compiler (for a moment) just make things work for you

Abdur-Rahmaan Janhangeer,
Mauritius
abdurrahmaanjanhangeer.wordpress.com

On 31 Jul 2017 3:10 am, "George Sconyers via Tutor" 
wrote:

> Hello all. I am getting started with Python and looking for a recommended
> compiler for an Ubuntu environment. I've been using gedit but don't get the
> benefit of auto-indentation and color coding of key words. It is laziness
> for sure but as the programs get longer I am increasingly OK with being
> lazy. Wpuld also like something that facilitates debuggig and stepping
> through code. Thoughts?
> ThanksGeorge
>
>
> Sent from Yahoo Mail for iPhone
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Recommended Python Compiler

2017-07-31 Thread Wolfgang Maier

On 07/31/2017 03:31 AM, Mats Wichmann wrote:

since this all opinions :), I don't think idle is worth bothering with. for 
editor that can do ide like things, consider atom (free, get a bunch of 
plugins) or sublime text (not free). for a full ide, pycharm is great 
(community edition free). for a lightweight ide to get started, i liked thonny 
when i trialed it at somebody's request, but do look at that wiki page, tons of 
choices there.


As you're saying, it is all about opinion here so let me defend IDLE 
here. There may be more powerful IDEs than IDLE, but it takes you a long 
way (far beyond beginner/scripting level) and, of interest if you are 
ever writing Python code on a Windows machine, typically comes installed 
together with the Python interpreter there, so you will find it on many 
machines (even ones you are not allowed to install other software on).


Best,
Wolfgang

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Recommended Python Compiler

2017-07-31 Thread Chris Warrick
On 31 July 2017 at 14:45, Wolfgang Maier
 wrote:
> On 07/31/2017 03:31 AM, Mats Wichmann wrote:
>>
>> since this all opinions :), I don't think idle is worth bothering with.
>> for editor that can do ide like things, consider atom (free, get a bunch of
>> plugins) or sublime text (not free). for a full ide, pycharm is great
>> (community edition free). for a lightweight ide to get started, i liked
>> thonny when i trialed it at somebody's request, but do look at that wiki
>> page, tons of choices there.
>
>
> As you're saying, it is all about opinion here so let me defend IDLE here.
> There may be more powerful IDEs than IDLE, but it takes you a long way (far
> beyond beginner/scripting level) and, of interest if you are ever writing
> Python code on a Windows machine, typically comes installed together with
> the Python interpreter there, so you will find it on many machines (even
> ones you are not allowed to install other software on).

IDLE is one step up from Notepad. Which makes it a pretty terrible
editor. It even lacks line numbers, which is an elementary feature,
and a necessity for debugging (tracebacks!)

On the other hand, some of the better editors (eg. Visual Studio Code)
provide .zip packages that do not require installation and can even
run off a USB stick.

-- 
Chris Warrick 
PGP: 5EAAEA16
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Recommended Python Compiler

2017-07-31 Thread Wolfgang Maier

On 07/31/2017 02:53 PM, Chris Warrick wrote:

On 31 July 2017 at 14:45, Wolfgang Maier
 wrote:

On 07/31/2017 03:31 AM, Mats Wichmann wrote:


since this all opinions :), I don't think idle is worth bothering with.
for editor that can do ide like things, consider atom (free, get a bunch of
plugins) or sublime text (not free). for a full ide, pycharm is great
(community edition free). for a lightweight ide to get started, i liked
thonny when i trialed it at somebody's request, but do look at that wiki
page, tons of choices there.



As you're saying, it is all about opinion here so let me defend IDLE here.
There may be more powerful IDEs than IDLE, but it takes you a long way (far
beyond beginner/scripting level) and, of interest if you are ever writing
Python code on a Windows machine, typically comes installed together with
the Python interpreter there, so you will find it on many machines (even
ones you are not allowed to install other software on).


IDLE is one step up from Notepad. Which makes it a pretty terrible
editor. It even lacks line numbers, which is an elementary feature,
and a necessity for debugging (tracebacks!)



- Displays current line number in lower right corner
- Has a goto line number option
- Lets you right-click line numbers ,emtioned in tracebacks, then jump 
right there


Have no intention to start a but-whatever-ide-is-better-debate

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] pythonic ascii decoding!

2017-07-31 Thread bruce
Hi guys.

Testing getting data from a number of different US based/targeted
websites. So the input data source for the most part, will be "ascii".
I'm getting a few "weird" chars every now and then asn as fas as I can
tell, they should be utf-8.

However, the following hasn;t always worked:
s=str(s).decode('utf-8').strip()

So, is there a quick/dirty approach I can use to simply strip out the
"non-ascii" chars. I know, this might not be the "best/pythonic" way,
and that it might result in loss of some data/chars, but I can live
with it for now.

thoughts/comments ??

thanks
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] pythonic ascii decoding!

2017-07-31 Thread Mats Wichmann
On 07/31/2017 09:39 AM, bruce wrote:
> Hi guys.
> 
> Testing getting data from a number of different US based/targeted
> websites. So the input data source for the most part, will be "ascii".
> I'm getting a few "weird" chars every now and then asn as fas as I can
> tell, they should be utf-8.
> 
> However, the following hasn;t always worked:
> s=str(s).decode('utf-8').strip()
> 
> So, is there a quick/dirty approach I can use to simply strip out the
> "non-ascii" chars. I know, this might not be the "best/pythonic" way,
> and that it might result in loss of some data/chars, but I can live
> with it for now.
> 
> thoughts/comments ??

It's easy enough to toss chars if you don't care what's being tossed,
which sounds like your case, something like:

''.join(i for i in s if ord(i) < 128)


but there's actually lots to think about here (I'm sure others will jump in)

- Python2 strings default to ascii, Python3 to unicode, there may be
some excitement with the use of ord() depending on how the string is
passed around
- websites will tell you their encoding, which you could and probably
should make use of
- web scraping with Python is a pretty well developed field, perhaps you
might want to use one of the existing projects? (https://scrapy.org/ is
pretty famous, certainly not the only one)
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Recommended Python Compiler

2017-07-31 Thread Abdur-Rahmaan Janhangeer
I may say that i was turned off by idle initially, never used it at all
until i landed on another pc to teach someone.

it changed my opinion on it, as it was not as horrible as expected. it was
nice enough not to overwhelm a beginner. it could open and run files
(and nice, at least a python editor made using the python language itself)

however of course, popular ides have done a far better job, but if you are
really screwed, it is ok and ... a normal beginner won't realise the
difference

else,
this is the first tutor thread i feel came on the brink of explosion

and may i suggest something, if someone is a beginner and will use
scientific packages often, better go on with spyder.

look you might say i won't need other packages but just for matplotlib, how
many sci modules you need?, as you follow awesome tutorials, one pulls in
the other. so, don't forget spyder even if py3.6 puts you off

cheers,

Abdur-Rahmaan Janhangeer,
Mauritius
abdurrahmaanjanhangeer.wordpress.com

On 31 Jul 2017 03:10, "George Sconyers via Tutor"  wrote:

> Hello all. I am getting started with Python and looking for a recommended
> compiler for an Ubuntu environment. I've been using gedit but don't get the
> benefit of auto-indentation and color coding of key words. It is laziness
> for sure but as the programs get longer I am increasingly OK with being
> lazy. Wpuld also like something that facilitates debuggig and stepping
> through code. Thoughts?
> ThanksGeorge
>
>
> Sent from Yahoo Mail for iPhone
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Quick question on dirsync a python pkg

2017-07-31 Thread Jeff VanderDoes
Hi,

Just curious if anyone can give me an explanation of when using the pkg
dirsync 2.2.2 what the difference is between --update and --sync option.
Maybe my brain is just a bit slow this morning.

Thanks!
Jeff
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Python isn't working with Apache (Windows)

2017-07-31 Thread Christopher McGrath
I am trying to run a simple python web script in a browser with apache. I have 
apache installed and running perfectly. I installed Ruby and Perl using 
instructions from here and worked perfect. 
http://editrocket.com/articles/python_apache_windows.html

I did have to change my “shebang lines” for PERL and RUBY like these:
#!Q:\LifeForce\perl\perl\bin\perl.exe
#!Q:\LifeForce\Ruby24-x64\bin\ruby.exe
As you can see, I didn’t install them on C: drive. They worked.

I had Python 3.6 installed before and tried to test with these
#!Q:\LifeForce\Python36-32\Scripts\pip3.exe
#!Q:\LifeForce\Python36-32\Scripts\pip.exe
#!Q:\LifeForce\Python36-32\Scripts\pip2.6.exe
All the pip files in the Script directory.
I also tried with #!Q:\LifeForce\Python36-32\python.exe. This one works worked 
from Window Command, but didn’t work from web browser like PERL and RUBY.
I tried downgrading to Python 2.7 and installed directly at C: drive and tested 
with
#!C:\Python27\python.exe
#!C:\Python27\Scripts\pip2.7.exe
#!C:\Python27\Scripts\pip2.exe
#!C:\Python27\Scripts\pip.exe
Nothing worked. I don’t have any idea anymore. Please help!
This is the simple code:
print ("Content-type: text/html")
print (" ")
print ("")
print ("")
print ("")
print ("Hello Python.")
print ("")

I am trying to run directly from Apache htdoc dir. Not from cgi dir. I think 
something is wrong with the shebang line.
This is the error output in the web browser:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to 
complete your request.
Please contact the server administrator at postmaster@localhost to inform them 
of the time this error occurred, and the actions you performed just before this 
error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to 
use an ErrorDocument to handle the request.
This is what is shown in Apache’s error log:
[Mon Jul 31 01:06:54.266478 2017] [cgi:error] [pid 5156:tid 1688] [client 
98.5.128.152:51723] malformed header from script 'test.py': Bad header:
[Mon Jul 31 01:06:54.270479 2017] [authz_core:error] [pid 5156:tid 1688] 
[client 98.5.128.152:51723] AH01630: client denied by server configuration: 
C:/Apache24








Christopher McGrath

[http://aawisdom.com/Top_of_main_files/BizCard-Front-hotmailSignature.jpg]
[http://aawisdom.com/Top_of_main_files/image001.gif]
www.aawisdom.com (716) 240-7786
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python isn't working with Apache (Windows)

2017-07-31 Thread George Fischhof
2017-07-31 7:31 GMT+02:00 Christopher McGrath :

> I am trying to run a simple python web script in a browser with apache. I
> have apache installed and running perfectly. I installed Ruby and Perl
> using instructions from here and worked perfect. http://editrocket.com/
> articles/python_apache_windows.html
>
> I did have to change my “shebang lines” for PERL and RUBY like these:
> #!Q:\LifeForce\perl\perl\bin\perl.exe
> #!Q:\LifeForce\Ruby24-x64\bin\ruby.exe
> As you can see, I didn’t install them on C: drive. They worked.
>
> I had Python 3.6 installed before and tried to test with these
> #!Q:\LifeForce\Python36-32\Scripts\pip3.exe
> #!Q:\LifeForce\Python36-32\Scripts\pip.exe
> #!Q:\LifeForce\Python36-32\Scripts\pip2.6.exe
> All the pip files in the Script directory.
> I also tried with #!Q:\LifeForce\Python36-32\python.exe. This one works
> worked from Window Command, but didn’t work from web browser like PERL and
> RUBY.
> I tried downgrading to Python 2.7 and installed directly at C: drive and
> tested with
> #!C:\Python27\python.exe
> #!C:\Python27\Scripts\pip2.7.exe
> #!C:\Python27\Scripts\pip2.exe
> #!C:\Python27\Scripts\pip.exe
> Nothing worked. I don’t have any idea anymore. Please help!
> This is the simple code:
> print ("Content-type: text/html")
> print (" ")
> print ("")
> print ("")
> print ("")
> print ("Hello Python.")
> print ("")
>
> I am trying to run directly from Apache htdoc dir. Not from cgi dir. I
> think something is wrong with the shebang line.
> This is the error output in the web browser:
> Internal Server Error
> The server encountered an internal error or misconfiguration and was
> unable to complete your request.
> Please contact the server administrator at postmaster@localhost to inform
> them of the time this error occurred, and the actions you performed just
> before this error.
> More information about this error may be available in the server error log.
> Additionally, a 500 Internal Server Error error was encountered while
> trying to use an ErrorDocument to handle the request.
> This is what is shown in Apache’s error log:
> [Mon Jul 31 01:06:54.266478 2017] [cgi:error] [pid 5156:tid 1688] [client
> 98.5.128.152:51723] malformed header from script 'test.py': Bad header:
> [Mon Jul 31 01:06:54.270479 2017] [authz_core:error] [pid 5156:tid 1688]
> [client 98.5.128.152:51723] AH01630: client denied by server
> configuration: C:/Apache24
>
>
>
>
>
> Christopher McGrath
>
> [http://aawisdom.com/Top_of_main_files/BizCard-Front-hotmailSignature.jpg]
> [http://aawisdom.com/Top_of_main_files/image001.gif]
> www.aawisdom.com (716) 240-7786
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>


Hi Christopher,

unfortunately I do not know much about your problem but I think it can be
useful to read about WSGI and WSGI web services, servers:

https://en.wikipedia.org/wiki/Web_Server_Gateway_Interface

https://www.python.org/dev/peps/pep-0333/

https://wiki.python.org/moin/WebFrameworks

https://www.fullstackpython.com/wsgi-servers.html


According to these articles I chose Flask for application server (it has a
built-in development webserver as well) and Waitress for webserver.
Maybe you can give them a try ;-)

BR
George
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python isn't working with Apache (Windows)

2017-07-31 Thread George Fischhof
2017-07-31 22:37 GMT+02:00 Christopher McGrath :

> Someone told me the problem is within the second line of the code.
>
>
> print ("Content-type: text/html")
> print (" ")
> print ("")
> print ("")
> print ("")
> print ("Hello Python.")
> print ("")
>
>
> There should be no space. I copied and pasted that code from somewhere and
> somehow that space has some hidden char that python didn't like...
>
>
> The one "who" does not like that space is not the Python, but the CGI
standard.
https://en.wikipedia.org/wiki/Common_Gateway_Interface

citation:

print "Content-type: text/plain\n\n";

end citation


there is blank line after content-type.


But when you use a framework, you do not have to care with cgi ;-)


BR

George


>
> *Christopher McGrath*
>
>
>
> *www.aawisdom.com  (716) 240-7786*
>
>
>
> --
> *From:* georgefisch...@gmail.com  on behalf of
> George Fischhof 
> *Sent:* Monday, July 31, 2017 8:34 PM
> *To:* Christopher McGrath
> *Cc:* tutor@python.org
> *Subject:* Re: [Tutor] Python isn't working with Apache (Windows)
>
>
>
> 2017-07-31 7:31 GMT+02:00 Christopher McGrath :
>
>> I am trying to run a simple python web script in a browser with apache. I
>> have apache installed and running perfectly. I installed Ruby and Perl
>> using instructions from here and worked perfect.
>> http://editrocket.com/articles/python_apache_windows.html
>>
>> I did have to change my “shebang lines” for PERL and RUBY like these:
>> #!Q:\LifeForce\perl\perl\bin\perl.exe
>> #!Q:\LifeForce\Ruby24-x64\bin\ruby.exe
>> As you can see, I didn’t install them on C: drive. They worked.
>>
>> I had Python 3.6 installed before and tried to test with these
>> #!Q:\LifeForce\Python36-32\Scripts\pip3.exe
>> #!Q:\LifeForce\Python36-32\Scripts\pip.exe
>> #!Q:\LifeForce\Python36-32\Scripts\pip2.6.exe
>> All the pip files in the Script directory.
>> I also tried with #!Q:\LifeForce\Python36-32\python.exe. This one works
>> worked from Window Command, but didn’t work from web browser like PERL and
>> RUBY.
>> I tried downgrading to Python 2.7 and installed directly at C: drive and
>> tested with
>> #!C:\Python27\python.exe
>> #!C:\Python27\Scripts\pip2.7.exe
>> #!C:\Python27\Scripts\pip2.exe
>> #!C:\Python27\Scripts\pip.exe
>> Nothing worked. I don’t have any idea anymore. Please help!
>> This is the simple code:
>> print ("Content-type: text/html")
>> print (" ")
>> print ("")
>> print ("")
>> print ("")
>> print ("Hello Python.")
>> print ("")
>>
>> I am trying to run directly from Apache htdoc dir. Not from cgi dir. I
>> think something is wrong with the shebang line.
>> This is the error output in the web browser:
>> Internal Server Error
>> The server encountered an internal error or misconfiguration and was
>> unable to complete your request.
>> Please contact the server administrator at postmaster@localhost to
>> inform them of the time this error occurred, and the actions you performed
>> just before this error.
>> More information about this error may be available in the server error
>> log.
>> Additionally, a 500 Internal Server Error error was encountered while
>> trying to use an ErrorDocument to handle the request.
>> This is what is shown in Apache’s error log:
>> [Mon Jul 31 01:06:54.266478 2017] [cgi:error] [pid 5156:tid 1688] [client
>> 98.5.128.152:51723] malformed header from script 'test.py': Bad header:
>> [Mon Jul 31 01:06:54.270479 2017] [authz_core:error] [pid 5156:tid 1688]
>> [client 98.5.128.152:51723] AH01630: client denied by server
>> configuration: C:/Apache24
>>
>>
>>
>>
>>
>> Christopher McGrath
>>
>> [http://aawisdom.com/Top_of_main_files/BizCard-Front-hotmailSignature.jpg
>> ]
>> [http://aawisdom.com/Top_of_main_files/image001.gif]
>> www.aawisdom.com (716) 240-7786
>> ___
>> Tutor maillist  -  Tutor@python.org
>> To unsubscribe or change subscription options:
>> https://mail.python.org/mailman/listinfo/tutor
>>
>
>
> Hi Christopher,
>
> unfortunately I do not know much about your problem but I think it can be
> useful to read about WSGI and WSGI web services, servers:
>
> https://en.wikipedia.org/wiki/Web_Server_Gateway_Interface
>
> https://www.python.org/dev/peps/pep-0333/
>
> https://wiki.python.org/moin/WebFrameworks
>
> https://www.fullstackpython.com/wsgi-servers.html
>
>
> According to these articles I chose Flask for application server (it has a
> built-in development webserver as well) and Waitress for webserver.
> Maybe you can give them a try ;-)
>
> BR
> George
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Recommended Python Compiler

2017-07-31 Thread Alan Gauld via Tutor
On 31/07/17 13:45, Wolfgang Maier wrote:

> here. There may be more powerful IDEs than IDLE, but it takes you a long 
> way (far beyond beginner/scripting level) 

And IdleX is a vastly superior, drop-in replacement, superset
of IDLE. The extra features, for those interested, are described
here:

http://idlex.sourceforge.net/features.html

It fixes most of the things people don't like about IDLE, except
for its appearance!

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] pythonic ascii decoding!

2017-07-31 Thread eryk sun
On Mon, Jul 31, 2017 at 3:39 PM, bruce  wrote:
>
> So, is there a quick/dirty approach I can use to simply strip out the
> "non-ascii" chars. I know, this might not be the "best/pythonic" way,
> and that it might result in loss of some data/chars, but I can live
> with it for now.

Ignore or replace the non-ASCII characters. For example:

>>> print 's\xffp\xffa\xffm'.decode('ascii', 'ignore')
spam
>>> print 's\xffp\xffa\xffm'.decode('ascii', 'replace')
s�p�a�m
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Recommended Python Compiler

2017-07-31 Thread Asokan Pichai
For a simple beginners editor -- geany is a great choice.

It can be used with minimal or no configuration/set up; and once
you know your way around  you can tweak it as much as you want.

It is easily installable on Debian/Ubuntu


-- 
Asokan Pichai
*---*
We will find a way. Or, make one. (Hannibal)
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor