What should i do

2014-06-27 Thread suburb4nfilth
Hello I finished the codeacademy python course a week ago and my goal is to 
start developing websites (both back and front end) ,my question is do i start 
the web dev tuts and learn the holes of knoledge on the go or continue to learn 
python? 

Thank you!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Execute a python script with CGI ?

2014-06-27 Thread dandrigo
Dear all,

1/ On my windows 8, i installed apache 2.2, python 2.7.

I coded a python script. I would like to execute this python script in CGI.I
would like enable GET pattern only (no POST pattern).  

Up to now : 

*i edited these following lines of my apache httpd.conf:
--
DocumentRoot "C:\Program Files (x86)\Apache Software
Foundation\Apache2.2\cgi-bin"

AddHandler cgi-script .cgi .py


 
*i created a htacess.txt and i pasted it into the file these following lines
:

# Interprétation des fichiers .py avant envoi au serveur HTTP
AddHandler cgi-script .py
Options +ExecCGI

# Fichiers index.py : indexes repertoires
DirectoryIndex index.py

  
* Si i writed a python script (web service with postgresql query). At the
begining of my script, i added these folloging lines :

import cgitb

cgitb.enable()

print("Content-Type: text/html;charset=utf-8")
print()
print("Hello World!")


=> What do you think about my configuration? I have made ​​a mistake? I do
have one more thing? How to test our CGI? our to ensure that my cgi works
well? 
I would like enable GET pattern only (no POST pattern). 

2/ On a 2nd time, i would like to do the same operation (for the same python
script web service/ GET pattern) but on our remote LINUX server.

=> What is the difference beetween windows and linux configuration? Could
you throw light for me? 

Thanks. 

Regards. 



--
View this message in context: 
http://python.6.x6.nabble.com/Execute-a-python-script-with-CGI-tp5062183p5062268.html
Sent from the Python - python-list mailing list archive at Nabble.com.
-- 
https://mail.python.org/mailman/listinfo/python-list


Contouring a 2D histogram

2014-06-27 Thread Jamie Mitchell
Hi all,

I have plotted a 2D histogram like so:

python2.7
import netCDF4
import iris
import iris.palette
import numpy as np
import matplotlib as mpl
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
from matplotlib.colors import from_levels_and_colors

fig=plt.figure()
nbins=20
nice_cmap=plt.get_cmap('brewer_RdYlBu_11')
colors=nice_cmap([5,6,7,8,9,10])
levels=[1,2,3,4,5]
cmap, norm=from_levels_and_colors(levels, colors, extend='both')

H, xedges, yedges=np.histogram2d(te_Q0_con_sw,hs_Q0_con_sw,bins=nbins)
Hmasked=np.ma.masked_where(H==0,H)
plt.pcolormesh(xedges,yedges,Hmasked,cmap=cmap,norm=norm,label='Q0 control')

# From this I get a 'scattered' 2D histogram.

Does anyone know how I can contour that scatter?

Thanks,

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


Re: What is the state of MySQL support for Python 3?

2014-06-27 Thread Egon Frerich
Am 24.06.2014 10:21, schrieb haiz...@gmail.com:
> Good day,
> 
> I'm starting a new project from scratch so I think its finally a time to 
> switch to the latest and greatest Python 3.4.
> 
> But I'm puzzled with MySQL support for Python 3. So far the only stable 
> library I've found it pymysql.
> 
> All others are either abandoned work-in-progress projects or do not support 
> Python 3:
>   * mysqldb - Python 2.x only
>   * mysql-ctypes - Python 2.x only
>   * amysql - Python 2.x only
>   * ultramysql - Python 2.x only
>   * MySQL Connector/Python - new guy in block. Does anyone use it?
>   * WebScaleSQL + MySQLdb1 [1] - still in development, state unknown?
>   * etc...
> 
> So what library do you use for MySQL access in Python 3?
> I'm specifically interested in async support (like in psycopg2 for 
> PostgreSQL) since I'm planning to use Tornado.
> 
> Thanks,
> Zaar
> 
> [1] https://github.com/farcepest/MySQLdb1 
> 
> https://code.facebook.com/posts/1474977139392436/webscalesql-a-collaboration-to-build-upon-the-mysql-upstream/
> 
> http://www.percona.com/live/mysql-conference-2014/sessions/asynchronous-mysql-how-facebook-queries-databases
> 

I have installed:

Metadata-Version: 1.1
Name: MySQL-python
Version: 1.2.3
Summary: Python interface to MySQL
Home-page: http://sourceforge.net/projects/mysql-python
Author: Andy Dustman
Author-email: adust...@users.sourceforge.net
License: GPL
Download-URL:
http://osdn.dl.sourceforge.net/sourceforge/mysql-python/MySQL-python-1.2.3.tar.gz

E.



smime.p7s
Description: S/MIME Cryptographic Signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What should i do

2014-06-27 Thread Paul McNett

On 6/27/14, 2:19 AM, suburb4nfi...@gmail.com wrote:

Hello I finished the codeacademy python course a week ago and my goal is to 
start developing websites (both back and front end) ,my question is do i start 
the web dev tuts and learn the holes of knoledge on the go or continue to learn 
python?


In my opinion if you want to start developing both front and backend of 
websites, then you should start developing a "full-stack" web 
application. You'll stumble and have to redo things along the way, but 
there's no better way to learn.


1) Get a Linux host with root access, like from Rackspace cloud. You are 
only charged while it is switched on. If you leave it on for a month 
you'll owe maybe $16.


2) Install python, virtualenv, pip, and a web framework. Starting with 
flask would be an excellent choice.


3) Install a database backend. Starting with PostgreSQL would be an 
excellent choice.


4) Implement the polling app from the Django tutorial, or maybe you have 
your own idea of a simple app to make.


5) Learn CSS and throw in some javascript to make it pretty.

6) Push your commits to GitHub along the way.


Do all of this and I can't promise how long it will take, but I can 
promise you'll be well on your way to becoming a strong web developer.


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


Re: print statements and profiling a function slowed performance

2014-06-27 Thread Mark Lawrence

On 27/06/2014 03:55, Steven D'Aprano wrote:

On Thu, 26 Jun 2014 13:37:41 -0700, CM wrote:


On Thursday, June 26, 2014 3:27:48 PM UTC-4, Mark Lawrence wrote:


3. use the logging module :)


I've just never got around to it, but I guess I should.  Thanks for the
nudge.


While using the logging module is recommended for logging, if you expect
that logging will be faster than print, I expect you will be disappointed.



Expectations don't count, measure it :)

--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


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


Re: Contouring a 2D histogram

2014-06-27 Thread Mark Lawrence

On 27/06/2014 13:09, Jamie Mitchell wrote:

Hi all,

I have plotted a 2D histogram like so:

python2.7
import netCDF4
import iris
import iris.palette
import numpy as np
import matplotlib as mpl
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
from matplotlib.colors import from_levels_and_colors

fig=plt.figure()
nbins=20
nice_cmap=plt.get_cmap('brewer_RdYlBu_11')
colors=nice_cmap([5,6,7,8,9,10])
levels=[1,2,3,4,5]
cmap, norm=from_levels_and_colors(levels, colors, extend='both')

H, xedges, yedges=np.histogram2d(te_Q0_con_sw,hs_Q0_con_sw,bins=nbins)
Hmasked=np.ma.masked_where(H==0,H)
plt.pcolormesh(xedges,yedges,Hmasked,cmap=cmap,norm=norm,label='Q0 control')

# From this I get a 'scattered' 2D histogram.

Does anyone know how I can contour that scatter?

Thanks,

Jamie



You're more likely to get answers from 
https://lists.sourceforge.net/lists/listinfo/matplotlib-users or, if you 
prefer the one stop shop, gmane.comp.python.matplotlib.general


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


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


how to build web based database performance monitoring application

2014-06-27 Thread sandhyaranimangipudi
Hi Gurus,

Can you pls suggest to build a web based application to monitor sybase database 
with the help of python, I am new to this.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: print statements and profiling a function slowed performance

2014-06-27 Thread Skip Montanaro
On Fri, Jun 27, 2014 at 10:55 AM, Mark Lawrence  wrote:
> Expectations don't count, measure it :)

It's no contest. I have measured it (ages ago). The logging module
does so many things that it's impossible for it to ever be as fast as
a simple print statement. Look at the code in LogRecord.__init__. Then
note the doc string:

... LogRecord instances are created every time something is logged. ...

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


Python reading and writing

2014-06-27 Thread aws Al-Aisafa
Why doesn't this code work?
http://pastebin.com/A3Sf9WPu
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python 3.44 float addition bug?

2014-06-27 Thread Ian Kelly
On Thu, Jun 26, 2014 at 9:24 PM, Chris Angelico  wrote:
> But you're right that this can be very surprising. And it's inherent
> to the concept of digits having more range than just "high" or "low",
> so there's no way you can get this with binary floats.

For an average of two numbers, I think that's true.  For an average of
more than two numbers, it's possible.

>>> a = 2.0 ** 53 - 1
>>> b = 2.0 ** 53 - 2
>>> a
9007199254740991.0
>>> b
9007199254740990.0
>>> (a + b + b) / 3
9007199254740989.0
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python reading and writing

2014-06-27 Thread Peter Otten
aws Al-Aisafa wrote:

> Why doesn't this code work?

> #I want this code to write to the first file and then take the
> #contents of the first file and copy them to the second.
>  
> from sys import argv
>  
> script, file1, file2 = argv
>  
>  
> def write_to_file(fileread, filewrite):
> '''Writes to a file '''
> filewrite.write(fileread)
>  
>  
> input_file = open(file1, 'r+w')
> output_file = open(file2, 'w')
>  
> datain = raw_input(">")
> input_file.write(datain)
>  
> print input_file.read()
>  
> write_to_file(input_file.read(), output_file)
> create a new version of this paste

> http://pastebin.com/A3Sf9WPu


> input_file.write(datain)

The file cursor is now positioned after the data you have just written. Then 
you read all data in the file *after* that data. As there is not data (you 
have reached the end of the file) the following prints the empty string:

> print input_file.read()
 
One way to fix this is to move the file pointer back to the beginning of the 
file with

input_file.seek(0)

so that a subsequent

input_file.read()

will return the complete contents of the file. 

For the simple example it would of course be sufficient to reuse datain:

write_to_file(datain, output_file)

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


Re:how to build web based database performance monitoring application

2014-06-27 Thread Dave Angel
sandhyaranimangip...@gmail.com Wrote in message:
> Hi Gurus,
> 
> Can you pls suggest to build a web based application to monitor sybase 
> database with the help of python, I am new to this.
> 

You'll probably get better answers if you're more specific.  What
 part of the assignment has you puzzled? Or what 'this' are you
 new to?  database,  Sybase,  web-based,  Python, 
 ...
-- 
DaveA

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


Re: Python reading and writing

2014-06-27 Thread aws Al-Aisafa
Thanks man.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to extract contents of inner text of html tag?

2014-06-27 Thread Jesse Adam
I don't have BeautifulSoup installed so I am unable to tell whether

a) for line in all_kbd:
processes one line at a time as given in the input, or do you get the clean
text in single lines in a list as shown in the example in the doc 
http://www.crummy.com/software/BeautifulSoup/bs4/doc/#searching-the-tree


b) for inside_line in line:
  Does this process one token at a time? 

In any case, it looks like the reason you got "None" in the output is 
because you assume that every single line contains  and  tags.
This may not be case all the time, so, prior to printing extract_code
perhaps you could check whether that is None.

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


Re: How to connect Python3.4.1 to Mysql 5.1 ?

2014-06-27 Thread jaahush

I am sure you could google this
but here's what I've done in the past


1) file 1 has the login info.
   I make it to prompt for user's password
   (you could hardcode the password in this file)

import getpass

USERNAME = "yourusername"
DBNAME   = "yourdatabasename"
PASSWORD = getpass.getpass("Enter password for database {0}: ".format(DBNAME))

login_info = {
   'host' : "your.sql.server.domain.name",
   'user' : USERNAME,
   'password' : PASSWORD,
   'database' : DBNAME,
   'port' : yoursqlport,
 }

2) file 2 has the SQL code

import mysql.connector
from file_1_above import login_info

db = mysql.connector.Connect(**login_info)
cursor = db.cursor()


>From here on, you use "cursor" to operate on your database.


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


Re: What should i do

2014-06-27 Thread alister
On Fri, 27 Jun 2014 08:18:24 -0700, Paul McNett wrote:

> On 6/27/14, 2:19 AM, suburb4nfi...@gmail.com wrote:
>> Hello I finished the codeacademy python course a week ago and my goal
>> is to start developing websites (both back and front end) ,my question
>> is do i start the web dev tuts and learn the holes of knoledge on the
>> go or continue to learn python?
> 
> In my opinion if you want to start developing both front and backend of
> websites, then you should start developing a "full-stack" web
> application. You'll stumble and have to redo things along the way, but
> there's no better way to learn.
> 
> 1) Get a Linux host with root access, like from Rackspace cloud. You are
> only charged while it is switched on. If you leave it on for a month
> you'll owe maybe $16.
Better yet host internally on your own Linux box
Even a Raspberry pi for <£45 (inc case PSU & sd card) could do this if 
you don't have a spare PC to use.

you don't want a development system exposed to the public internet anyway 
(unless you want to become Nicos Mk 2)
> 
> 2) Install python, virtualenv, pip, and a web framework. Starting with
> flask would be an excellent choice.
> 
> 3) Install a database backend. Starting with PostgreSQL would be an
> excellent choice.
> 
> 4) Implement the polling app from the Django tutorial, or maybe you have
> your own idea of a simple app to make.
> 
> 5) Learn CSS and throw in some javascript to make it pretty.
> 
> 6) Push your commits to GitHub along the way.
> 
> 
> Do all of this and I can't promise how long it will take, but I can
> promise you'll be well on your way to becoming a strong web developer.
> 
> Paul





-- 
Don't worry about people stealing your ideas.  If your ideas are any good,
you'll have to ram them down people's throats.
-- Howard Aiken
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What should i do

2014-06-27 Thread Paul McNett

On 6/27/14, 11:12 AM, alister wrote:

On Fri, 27 Jun 2014 08:18:24 -0700, Paul McNett wrote:


On 6/27/14, 2:19 AM, suburb4nfi...@gmail.com wrote:

Hello I finished the codeacademy python course a week ago and my goal
is to start developing websites (both back and front end) ,my question
is do i start the web dev tuts and learn the holes of knoledge on the
go or continue to learn python?


In my opinion if you want to start developing both front and backend of
websites, then you should start developing a "full-stack" web
application. You'll stumble and have to redo things along the way, but
there's no better way to learn.

1) Get a Linux host with root access, like from Rackspace cloud. You are
only charged while it is switched on. If you leave it on for a month
you'll owe maybe $16.

Better yet host internally on your own Linux box
Even a Raspberry pi for <£45 (inc case PSU & sd card) could do this if
you don't have a spare PC to use.

you don't want a development system exposed to the public internet anyway
(unless you want to become Nicos Mk 2)


Well, that's part of the experience too. :)  Seriously, set up the 
firewall to only allow port 80 from your address, etc.


Installing VirtualBox and Ubuntu on your local system is probably the 
better way to go at first, agreed.


Paul


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


Re: [RELEASE] fastcache

2014-06-27 Thread ptb
The 0.2 release is out!  Python versions 2.6, 2.7, 3.2, 3.3, and 3.4 are now 
supported.

On Wednesday, June 25, 2014 12:15:02 PM UTC-6, ptb wrote:
> Hello all,
> 
> 
> 
> I am pleased to announce the release of fastcache v0.1.  It is intended to be 
> a drop in replacement for functools.lru_cache but it's written in C so it's 
> 5-10x faster.  Currently Python >= 3.3 is supported.
> 
> 
> 
> It is available on pip via:
> 
> 
> 
> pip install fastcache
> 
> 
> 
> Or on github:
> 
> 
> 
> https://github.com/pbrady/fastcache.git
> 
> 
> 
> More details related to benchmarking and testing can also be found on the 
> github page.  
> 
> 
> 
> Feel free to direct any issues or requests to the github page.
> 
> 
> 
> I look forward to your feedback!
> 
> 
> 
> Thanks,
> 
> Peter.

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


Re: What should i do

2014-06-27 Thread suburb4nfilth
Thank you for the fast response guys, what if I go with django instead of flask 
and is javascript hard to learn considering that I have no knoledge of any 
other language beside Python?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What should i do

2014-06-27 Thread alister
On Fri, 27 Jun 2014 12:39:49 -0700, suburb4nfilth wrote:

> Thank you for the fast response guys, what if I go with django instead
> of flask and is javascript hard to learn considering that I have no
> knoledge of any other language beside Python?

I guess it depends on what you want it to do

Personally i prefer to get pages working without any javascript & then 
simply use javascript to enhance a working site rather than depend on it.



-- 
Paranoid schizophrenics outnumber their enemies at least two to one.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What should i do

2014-06-27 Thread Joel Goldstick
On Jun 27, 2014 3:42 PM,  wrote:
>
> Thank you for the fast response guys, what if I go with django instead of
flask and is javascript hard to learn considering that I have no knoledge
of any other language beside Python?
> --
Check out jquery

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


Re: print statements and profiling a function slowed performance

2014-06-27 Thread Ian Kelly
On Fri, Jun 27, 2014 at 10:05 AM, Skip Montanaro  wrote:
> On Fri, Jun 27, 2014 at 10:55 AM, Mark Lawrence  
> wrote:
>> Expectations don't count, measure it :)
>
> It's no contest. I have measured it (ages ago). The logging module
> does so many things that it's impossible for it to ever be as fast as
> a simple print statement. Look at the code in LogRecord.__init__. Then
> note the doc string:
>
> ... LogRecord instances are created every time something is logged. ...

While I'm not disputing your measurement, doesn't the logging module
delegate the actual I/O to a separate thread?  That's got to count for
something, compared to a raw print that has to wait for the I/O to
finish.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3.4.1 installer on Mac links Python to old Tcl/Tk

2014-06-27 Thread Peter Tomcsanyi


"Christian Gollwitzer"  wrote in message 
news:loh45o$14g$1...@dont-email.me...
As I said, it doesn't have a special interface, you just load it and 
that's it. So if you do a tk.eval("package require tkpng"), your 
Tk.PhotoImage will magically recognize PNG.


I will try it on the Mac, but on Windows this does not work (with python.org 
installation of Python), and I need to have the same environment on both Win 
and Mac (at least).


On the Mac you can create an APP bundle which contains everything, 
including extra dependencies.


Thanks for the hint, I may consider it, but maybe it is not applicable to my 
project where the outcome should be in fact a few modules in Python and the 
en-users (college students) should program in Python using IDLE and those 
extra modules. So there is no "Main program" and there will be no 
"application".

Is an APP budle applicable for such a situation?

Yes this was a long-deferred feature due to its inhomogeneous 
implementation on the supported platforms. There were some extensions like 
10 years ago to do it, but only in 8.6 (2012) it made it into the core Tk.


Thanks for many insights into Tk and your hints.
I will try some of them in next days and maybe later I will come with some 
more questions.


Peter


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


Re: OT: This Swift thing

2014-06-27 Thread Albert van der Horst
In article ,
Chris Angelico   wrote:
>On Thu, Jun 12, 2014 at 12:08 PM, Steven D'Aprano
> wrote:
>> I'm just pointing out that our computational technology uses
>> over a million times more energy than the theoretical minimum, and
>> therefore there is a lot of room for efficiency gains without sacrificing
>> computer power. I never imagined that such viewpoint would turn out to be
>> so controversial.
>
>The way I understand it, you're citing an extremely theoretical
>minimum, in the same way that one can point out that we're a long way
>from maximum entropy in a flash memory chip, so it ought to be
>possible to pack a lot more data onto a USB stick. The laws of physics
>tend to put boundaries that are ridiculously far from where we
>actually work - I think most roads have speed limits that run a fairly
>long way short of c.

As a physicist I'm well aware that houses need no heating.
With a suitable isolation and top-notch heat-exchangers in the
ventilation system, our bodies generate enough heat to keep our houses
at a comfortable 21 degrees. (Well, and there is the disk washer.)

In the same vain cars need very little fuel, we just must accept that
cars move slightly slower than we could walk.

>
>ChrisA
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

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


What can Nuitka do?

2014-06-27 Thread CM
(Trying again, simpler and cleaner post)

Can I use Nuitka to transform a wxPython 
GUI application in Python that uses several
3rd party modules into a small and faster
compiled-to-C executable?
-- 
https://mail.python.org/mailman/listinfo/python-list


What can PyPy do?

2014-06-27 Thread CM
Can I use PyPy to transform a wxPython
GUI application in Python that uses several
3rd party modules into a faster Python 
application that can be distributed as 
an exe?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: multiprocessing in a while loop?

2014-06-27 Thread Jesse Adam

Could you post 
a) what the output looks like now (sans the logging part)
b) what output do you expect


In any event, this routine does not look right to me:

def consume_queue(queue_name):
  conn = boto.connect_sqs()
  q = conn.get_queue(queue_name)
  m = q.read()
  while m is not None:
yield m
q.delete_message(m)
logger.debug('message deleted')
m = q.read()
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What can Nuitka do?

2014-06-27 Thread Paul Sokolovsky
Hello,

On Fri, 27 Jun 2014 16:25:02 -0700 (PDT)
CM  wrote:

> (Trying again, simpler and cleaner post)
> 
> Can I use Nuitka to transform a wxPython 
> GUI application in Python that uses several
> 3rd party modules into a small and faster
> compiled-to-C executable?

Yes, you can. So, please try that, and report how that went. We're
eager to know how that would go very much. But unlike you, we don't
have need to transform wxPython GUI application in Python into
an executable. So, you are in the best position to answer your question.

And surprisingly, both Nuitka and PyPy are free, so you won't need to
shell out few $Ks to try it, or wear your suit, hop on the plane, and
go to another side of the country (or world) and spend many hours in
negotiations to get an evaluation license. Just download and try.
Unbelievable, how world has changed in some 30-40 years!



-- 
Best regards,
 Paul  mailto:pmis...@gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: print statements and profiling a function slowed performance

2014-06-27 Thread Skip Montanaro
On Fri, Jun 27, 2014 at 4:35 PM, Ian Kelly  wrote:
> That's got to count for
> something, compared to a raw print that has to wait for the I/O to
> finish.

A raw print basically just tosses some bytes in a stdio buffer (at
least in Unix-land). Stdio does whatever little it does, then passes
the bytes off to the operating system. The underlying OS is then
responsible to see that the bytes get to disk or syslog, or wherever.
It's hard for me to see how that process would be any more time
consuming than the necessary thread switching, followed by what is
essentially the same activity. I haven't looked at the logging module
in awhile (I eventually just rolled my own much simpler version which
only supports what I need), but I don't think it used threads to
perform the actual I/O when it was first written.

Aside... The actual straw that broke the camel's back was that at
work...  One of our C++ programmers wrote a threaded logging module
(to speed up logging by handling it in a thread  - hmmm... sounds
familiar) then wrapped it for use in our Python-based platform. Time
passed, that guy moved on, and I became the sole maintainer of this
particular code base. Finally tired of our applications deadlocking at
inopportune times, I tossed out the threaded stuff and rewrote just
the small bit of the logging module's features I needed in Python. No
performance hit. No deadlocks.

threading-doesn't-always-speed-things-up-ly, y'rs,

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


Re: print statements and profiling a function slowed performance

2014-06-27 Thread Chris Angelico
On Sat, Jun 28, 2014 at 10:12 AM, Skip Montanaro  wrote:
> threading-doesn't-always-speed-things-up-ly, y'rs,

Threading is a focus of so many myths. People who don't understand it
think that threads are magic pixie dust that fixes everything, or else
magic pixie dust that breaks everything. Or both, at the same time.
Neither notion is true.

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


Re: print statements and profiling a function slowed performance

2014-06-27 Thread Mark Lawrence

On 28/06/2014 01:12, Skip Montanaro wrote:

On Fri, Jun 27, 2014 at 4:35 PM, Ian Kelly  wrote:

That's got to count for
something, compared to a raw print that has to wait for the I/O to
finish.


A raw print basically just tosses some bytes in a stdio buffer (at
least in Unix-land).



Exactly, in Windows land you're talking chalk and cheese when comparing 
logging to printing to a command window.


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


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


Re: What can Nuitka do?

2014-06-27 Thread Rustom Mody
On Saturday, June 28, 2014 5:14:39 AM UTC+5:30, Paul Sokolovsky wrote:
> Hello,

> On Fri, 27 Jun 2014 16:25:02 -0700 (PDT)
> CM wrote:

> > (Trying again, simpler and cleaner post)
> > Can I use Nuitka to transform a wxPython 
> > GUI application in Python that uses several
> > 3rd party modules into a small and faster
> > compiled-to-C executable?

> Yes, you can. So, please try that, and report how that went. We're
> eager to know how that would go very much. But unlike you, we don't
> have need to transform wxPython GUI application in Python into
> an executable. So, you are in the best position to answer your question.

> And surprisingly, both Nuitka and PyPy are free, so you won't need to
> shell out few $Ks to try it, or wear your suit, hop on the plane, and
> go to another side of the country (or world) and spend many hours in
> negotiations to get an evaluation license. Just download and try.
> Unbelievable, how world has changed in some 30-40 years!


All true...
However programming is engineering and programmers can suffer severe
paradox of choice if there's too much to choose from.

Going back along a different track by a couple of decades:

20 years ago python pushed the envelope of being a sweet combination of
being a serious system programming+lightweight scripting language at the same
time.

Today there are other choices¹:

- There are new languages that outright set out to be be as
efficient as C/FORTRAN -- eg Julia.

- A whole crop of new languages that are striving to plough back (some of)
scripting convenience into the compiled language mold -- eg Swift, Go

Languages that handle modern multicore hardware appropriately -- Erlang

And finally functional programming has come of age. So eg one of Haskell's
agendas is to beat C/Fortran's performance:

| Remarkably, our benchmarks show that choosing the proper stream
| representations can result in machine code that beats
| compiler-vectorized C, and that is competitive with hand-tuned
| assembly. --
|   From  
http://research.microsoft.com/en-us/um/people/simonpj/papers/ndp/haskell-beats-C.pdf

tl;dr:

If no one speaks up (with hard specific data!) for the technologies
you are considering (eg PyPy, Nuitka etc) then I would conclude that
they are not yet ready for prime-time/ your use-case


¹ Yeah that seemingly adds to the paradox of choice problem!!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What can Nuitka do?

2014-06-27 Thread Steven D'Aprano
On Fri, 27 Jun 2014 19:10:25 -0700, Rustom Mody wrote:

> If no one speaks up (with hard specific data!) for the technologies you
> are considering (eg PyPy, Nuitka etc) then I would conclude that they
> are not yet ready for prime-time/ your use-case

A silly conclusion. The OP's use-case is quite specific, namely he wants 
to freeze a wxPython GUI app in a single executable *and* optimize it, 
while this mailing list is very general. Most people here are not experts 
on *any* of Nuitka, PyPy, wxPython or freezing applications, let alone 
all of them. Lack of hard specific evidence is not evidence that the job 
cannot be done, it's just evidence that the people here don't know how.

Having said that, I think that the OP's question is probably misguided. 
He or she gives the impression of expecting PyPy or Nuitka to be a magic 
button that will speed up the user experience, like the Turbo button on 
old PCs. (Remember them?) It's not likely to be that easy.

wxPython is a wrapper to a C GUI library, all the work is done in C, not 
Python, so moving to PyPy or Nuitka won't speed it up. It may even slow 
it down, if the interpreter is less efficient at calling C libraries.

Additionally, in most GUI apps (although not all), the main bottleneck is 
usually not the programming language but the user. GUI apps tend to spend 
95% of their time idling, waiting for the user. Its been a *long* time 
since the GUI framework itself has lagged behind the user's input, except 
in cases of memory exhaustion. So if the OP is interested in speeding up 
his or her application, the first thing to do is to identify what parts 
of it are slow, identify why they're slow, and concentrate on those parts.

For example, if the OP's app is slow because it repeatedly scans a remote 
network directory, then moving to PyPy won't speed it up, because file 
operations over a network are inherently slow. If it's slow because it 
foolishly uses bubble sort to sort 1000 items instead of Python's built-
in sort, then moving to PyPy may technically speed it up, but probably 
not enough to notice.

Some problems are inherently slow. Some are fixable by using better 
algorithms. And some are fixable by using an optimizing compiler like 
PyPu or Nuitka. We are given no reason to think that the OP's problems 
lie in that third area rather than the first two.


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


Re: What can Nuitka do?

2014-06-27 Thread CM
On Friday, June 27, 2014 7:44:39 PM UTC-4, Paul Sokolovsky wrote:
> Yes, you can. So, please try that, and report 
> how that went. We're eager to know how that would 
> go very much. But unlike you, we don't have need 
> to transform wxPython GUI application in Python into
> an executable. So, you are in the best position to 
> answer your question.

I downloaded and installed Nuitka 0.5.2 for Windows, 
but it seems like the entirety of the instructions 
for what I want to do, as shown on the Docs web page, 
is this:

nuitka --recurse-all program.py

I would need more help than that to try this. I've
never even used MinGW, for example.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What can Nuitka do?

2014-06-27 Thread Steven D'Aprano
On Fri, 27 Jun 2014 20:06:36 -0700, CM wrote:

> On Friday, June 27, 2014 7:44:39 PM UTC-4, Paul Sokolovsky wrote:
>> Yes, you can. So, please try that, and report how that went. We're
>> eager to know how that would go very much. But unlike you, we don't
>> have need to transform wxPython GUI application in Python into an
>> executable. So, you are in the best position to answer your question.
> 
> I downloaded and installed Nuitka 0.5.2 for Windows, but it seems like
> the entirety of the instructions for what I want to do, as shown on the
> Docs web page, is this:
> 
> nuitka --recurse-all program.py
> 
> I would need more help than that to try this.


I'm not a Windows user, so I can't give detailed step-by-step "mouse over 
this menu, click this button" instructions, but you need to open a 
command line terminal. (command.com or cmd.exe, I forget which, although 
I understand that these days Windows programmers prefer PowerShell.) At 
the prompt, type:

cd "C:/path/to/where/your/program/lies/"

then hit Enter. (Of course, you don't *literally* type what I showed, you 
the actual path to your program.)

Confirm that your program is there: at the shell prompt, type

   dir


then hit Enter, and make sure you see your program, something_or_other.py.

Now type 

nuitka --recurse-all something_or_other.py


and hit Enter. What happens?

(Don't be discouraged if there are a bunch of errors.)



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


Re: how to build web based database performance monitoring application

2014-06-27 Thread sandhyaranimangipudi
In this moment we are monitoring sybase ASE database server by shell 
script(cron job) these data we are pushing to other database server what we 
call is monitoring server. After business hrs we are gathering metrics for each 
job/server cpu,disk i/o,memory, dbspace usages through some store procedures 
manually  now we are planing to build a platform like a web based dash board so 
that the business owners can monitor their jobs/process load on server, this 
will help them to enhance their procedures(like modification sp's) in a single 
short.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What can Nuitka do?

2014-06-27 Thread Michael Torrie
On 06/27/2014 09:06 PM, CM wrote:
> On Friday, June 27, 2014 7:44:39 PM UTC-4, Paul Sokolovsky wrote:
>> Yes, you can. So, please try that, and report 
>> how that went. We're eager to know how that would 
>> go very much. But unlike you, we don't have need 
>> to transform wxPython GUI application in Python into
>> an executable. So, you are in the best position to 
>> answer your question.
> 
> I downloaded and installed Nuitka 0.5.2 for Windows, 
> but it seems like the entirety of the instructions 
> for what I want to do, as shown on the Docs web page, 
> is this:
> 
> nuitka --recurse-all program.py
> 
> I would need more help than that to try this. I've
> never even used MinGW, for example.

I presume you can learn the same way many of us learn. But reading up on
it and trying things out.  I bet there's even a MinGW list.  Really it's
standard command-line stuff. Learn how to use a unix command line and
you'll be able to grasp it all rather easily I think.  Good luck.

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


Re: What can Nuitka do?

2014-06-27 Thread CM
On Friday, June 27, 2014 11:09:11 PM UTC-4, 
Steven D'Aprano wrote:
 
> Having said that, I think that the OP's question 
> is probably misguided. 

Thanks, Steven, for the input. It very well might be.  
I'll give a little more information.
 
> He or she gives the impression of expecting PyPy 
> or Nuitka to be a magic button that will speed up 
> the user experience, like the Turbo button on 
> old PCs. (Remember them?) It's not likely to be 
> that easy.

I'm sure it does give just that impression. I'll 
admit that if it *did* do something like that, I'd
be pleased, of course. But I expected it not to work
so well as that, or perhaps not work at all. Really,
I asked more out of curiosity, since these projects
keep staying out there but I rarely read about people
actually using them.  They seem more like proof of
principle intellectual work, but I really know not of
what I speak, and so was trying to get more 
understanding. I also thought it may be helpful in
creating a standalone executable (instead of using
the various ways to do that with Python, which I am
familiar with and have done successfully), and wanted
to see if there were any advantages to that (such as
a smaller file size).

> wxPython is a wrapper to a C GUI library, all the 
> work is done in C, not Python, 

There are some pure Python widgets in wxPython, such
as many or perhaps all within the AGW subdirectory, 
which are some really nice contributions by Andrea
Gavana.  And I believe it's a C++ library, not C.


> so moving to PyPy or Nuitka won't speed it up. 

It may not; I really wasn't sure and thought I'd 
give it a try and see what happened (if it wasn't
a major undertaking to give it a try).

> Additionally, in most GUI apps (although not all), 
> the main bottleneck is usually not the programming 
> language but the user. GUI apps tend to spend 
> 95% of their time idling, waiting for the user. Its 
> been a *long* time since the GUI framework itself 
> has lagged behind the user's input, except 

Although that is true, I have found that I have
managed to get wxPython apps to feel laggy in certain
parts, particularly on not-very-fast computers. I
can see this in starting up the program and some
other areas such as repainting damaged windows
rapidly. It's not a huge effect, but it does 
influence the "look and feel" and I care about it.

> except in cases of memory exhaustion. 

Maybe this is a key issue on one of the older
laptops I was testing on.  The thing is, though,
there are still a lot of SLOW computers out there
in userland, sadly, and doing what one can to 
mitigate the laggy UX by speeding up the program
seems like a virtuous goal. 

> his or her application, the first thing to do is 
> to identify what parts of it are slow, identify 
> why they're slow, and concentrate on those parts.

That's underway, and helping.  I just idly thought
about the state of compilers and JIT and such and
wondered.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What can Nuitka do?

2014-06-27 Thread Rustom Mody
On Saturday, June 28, 2014 8:58:04 AM UTC+5:30, Michael Torrie wrote:
> On 06/27/2014 09:06 PM, CM wrote:
> > On Friday, June 27, 2014 7:44:39 PM UTC-4, Paul Sokolovsky wrote:
> >> Yes, you can. So, please try that, and report 
> >> how that went. We're eager to know how that would 
> >> go very much. But unlike you, we don't have need 
> >> to transform wxPython GUI application in Python into
> >> an executable. So, you are in the best position to 
> >> answer your question.
> > I downloaded and installed Nuitka 0.5.2 for Windows, 
> > but it seems like the entirety of the instructions 
> > for what I want to do, as shown on the Docs web page, 
> > is this:
> > nuitka --recurse-all program.py
> > I would need more help than that to try this. I've
> > never even used MinGW, for example.

> I presume you can learn the same way many of us learn. But reading up on
> it and trying things out.  I bet there's even a MinGW list.  Really it's
> standard command-line stuff. Learn how to use a unix command line and
> you'll be able to grasp it all rather easily I think.  Good luck.

Have you tried it?

I tried it a few months back... it turned out that its not one (turnkey)
solution but a whole setup in which dozens (hundreds?) of
programs need to be selected (like in synaptic) almost like setting
a full-scale linux box from scratch.

Then after that there is the wrestling with library paths...

In the end I found setting up ming in linux with apt and trying out the results
in wine was less taxing.

[Of course I freely admit that linux is generally less taxing (to ME) than
windows]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What can Nuitka do?

2014-06-27 Thread CM

 
> I'm not a Windows user, so I can't give detailed 
> step-by-step "mouse over this menu, click this 
> button" instructions, but you need to open a  
> command line terminal. (command.com or cmd.exe, 

I'm not *quite* that at sea!  :D  Close, but I am
used to using the command line in Windows. 

> Now type 

> nuitka --recurse-all something_or_other.py
 
> and hit Enter. What happens?

I did that and the message is:

   'nuitka' is not recognized as an internal 
   or external command, operable program or batch file.

which makes sense because some kind of file called 
nuitka is not in my path. What I wasn't sure of is how 
to add it, because I looked in the nuitka folder in 
Python27/Lib/site-packages and there was no file 
called nuitka.py or nuitka.exe within that folder, 
and there were a lot of subfolders but I just didn't 
know what I should do.  

I have used Linux but not in a while and I can't recall
how installing it is different in terms of the OS 
knowing what "nuitka" means in the command line.
(I installed nuitka for Windows via an installer).

Even once I do this, nuitka won't work until I get
MingGW on here, too, but one step at a time.  I'd like
to get it to at least fail at that point first.

But Rustom Mody's comment suggests this may turn out
to be more work than I am willing to do right now...?


> 
> 
> 
> (Don't be discouraged if there are a bunch of errors.)
> 
> 
> 
> 
> 
> 
> 
> -- 
> 
> Steven

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


Re: What can Nuitka do?

2014-06-27 Thread Michael Torrie
On 06/27/2014 09:44 PM, CM wrote:
>> Additionally, in most GUI apps (although not all), 
>> the main bottleneck is usually not the programming 
>> language but the user. GUI apps tend to spend 
>> 95% of their time idling, waiting for the user. Its 
>> been a *long* time since the GUI framework itself 
>> has lagged behind the user's input, except 
> 
> Although that is true, I have found that I have
> managed to get wxPython apps to feel laggy in certain
> parts, particularly on not-very-fast computers. I
> can see this in starting up the program and some
> other areas such as repainting damaged windows
> rapidly. It's not a huge effect, but it does 
> influence the "look and feel" and I care about it.

I highly doubt this lagginess has anything to do with Python, honestly.
 If you're seeing slowdowns in the areas you state, you'll probably
experience the same issues in the equivalent C++ version.  All drawing
is done by the underlying binary library.

I've made GUIs in GTK and Qt with Python and never had any that was
appreciably slower than C or C++ apps.

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


Re: What can Nuitka do?

2014-06-27 Thread Rustom Mody
On Saturday, June 28, 2014 9:27:02 AM UTC+5:30, CM wrote:
> > I'm not a Windows user, so I can't give detailed 
> > step-by-step "mouse over this menu, click this 
> > button" instructions, but you need to open a  
> > command line terminal. (command.com or cmd.exe, 

> I'm not *quite* that at sea!  :D  Close, but I am
> used to using the command line in Windows. 

> > Now type 

> > nuitka --recurse-all something_or_other.py

> > and hit Enter. What happens?

> I did that and the message is:

>'nuitka' is not recognized as an internal 
>or external command, operable program or batch file.

> which makes sense because some kind of file called 
> nuitka is not in my path. What I wasn't sure of is how 
> to add it, because I looked in the nuitka folder in 
> Python27/Lib/site-packages and there was no file 
> called nuitka.py or nuitka.exe within that folder, 
> and there were a lot of subfolders but I just didn't 
> know what I should do.  

> I have used Linux but not in a while and I can't recall
> how installing it is different in terms of the OS 
> knowing what "nuitka" means in the command line.
> (I installed nuitka for Windows via an installer).

> Even once I do this, nuitka won't work until I get
> MingGW on here, too, but one step at a time.  I'd like
> to get it to at least fail at that point first.

> But Rustom Mody's comment suggests this may turn out
> to be more work than I am willing to do right now...?

In all fairness, I know nothing of nuitka.
But I see:

- that it is active (in development)
- there are nuitka mailing list(s)...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What can Nuitka do?

2014-06-27 Thread Stefan Behnel
CM, 28.06.2014 05:57:
>> Now type 
>> 
>> nuitka --recurse-all something_or_other.py
>>  
>> and hit Enter. What happens?
> 
> I did that and the message is:
> 
>'nuitka' is not recognized as an internal 
>or external command, operable program or batch file.
> 
> which makes sense because some kind of file called 
> nuitka is not in my path. What I wasn't sure of is how 
> to add it, because I looked in the nuitka folder in 
> Python27/Lib/site-packages and there was no file 
> called nuitka.py or nuitka.exe within that folder, 
> and there were a lot of subfolders but I just didn't 
> know what I should do.  

There should be a folder Python27/Scripts that contains the executable
programs that Python packages install.

Stefan


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


Re: What can Nuitka do?

2014-06-27 Thread CM
On Saturday, June 28, 2014 12:23:03 AM UTC-4, 
Stefan Behnel wrote:

> There should be a folder Python27/Scripts that 
> contains the executable programs that Python packages 
> install.

Thank you, yes, it's there.  But there are two
files:  nuitka (I don't see an extension and
don't know the file type) and nuitka.bat.  I 
added C:/Python27/Scripts/nuitka to the Windows 
path but it still doesn't recognize the name.

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


Re: What can Nuitka do?

2014-06-27 Thread Chris Angelico
On Sat, Jun 28, 2014 at 2:14 PM, Michael Torrie  wrote:
> On 06/27/2014 09:44 PM, CM wrote:
>>> Additionally, in most GUI apps (although not all),
>>> the main bottleneck is usually not the programming
>>> language but the user. GUI apps tend to spend
>>> 95% of their time idling, waiting for the user. Its
>>> been a *long* time since the GUI framework itself
>>> has lagged behind the user's input, except
>>
>> Although that is true, I have found that I have
>> managed to get wxPython apps to feel laggy in certain
>> parts, particularly on not-very-fast computers. I
>> can see this in starting up the program and some
>> other areas such as repainting damaged windows
>> rapidly. It's not a huge effect, but it does
>> influence the "look and feel" and I care about it.
>
> I highly doubt this lagginess has anything to do with Python, honestly.
>  If you're seeing slowdowns in the areas you state, you'll probably
> experience the same issues in the equivalent C++ version.  All drawing
> is done by the underlying binary library.
>
> I've made GUIs in GTK and Qt with Python and never had any that was
> appreciably slower than C or C++ apps.

Agreed, and there's a fairly easy way to test it (at least, under
Linux): just look in 'top' and see if a significant proportion of the
time is spent in a process called Xorg rather than your python
process. The last time I had a program that could actually saturate a
thread with GUI API calls, it generally ended up split somewhere
between 25% and 75% across my process and Xorg. (Best I could do just
now, in testing, was to hold PgUp/PgDn in an unoptimized program that
repainted the screen immediately whenever it needed to. According to
top, I was using 52% of a core in Xorg, and about 16% of a core in my
code. With a slower computer, that would work out to 75% Xorg and 25%
high level code.) At that point, changing language won't affect
performance one iota, and certainly changing Python interpreter won't
do anything for you. The way to improve performance is to cut out some
of the drawing calls. (The saturation problem came because the code
was naively trying to draw a whole lot of stuff that was hidden behind
a scroll viewport. Adding a quick check "is this sorta close to the
screen" gave me all the improvement I needed.)

The only other time I've been waiting for X display was when I was
mobile, on a 3G connection, and using X11 forwarding on an SSH link
back to my home LAN. For some reason, displaying a remote desktop view
of a VM takes quite a while when every pixel has to be sent over 3G...
but, again, no Python code performance involved :)

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


Re: What can Nuitka do?

2014-06-27 Thread Chris Angelico
On Sat, Jun 28, 2014 at 2:45 PM, CM  wrote:
> On Saturday, June 28, 2014 12:23:03 AM UTC-4,
> Stefan Behnel wrote:
>
>> There should be a folder Python27/Scripts that
>> contains the executable programs that Python packages
>> install.
>
> Thank you, yes, it's there.  But there are two
> files:  nuitka (I don't see an extension and
> don't know the file type) and nuitka.bat.  I
> added C:/Python27/Scripts/nuitka to the Windows
> path but it still doesn't recognize the name.

Just add Scripts to path (not Scripts/nuitka), and it should run
nuitka.bat. I would guess that the one without an extension is a Unix
shell script of some sort; have a look at it, see if it's a text file
that begins "#!/bin/sh" or similar. Most likely the file sizes of
nuitka and nuitka.bat will be similar - of the order of hundreds of
bytes, even, as they're probably just invoking Python.

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


Re: What can Nuitka do?

2014-06-27 Thread CM
 
> Just add Scripts to path (not Scripts/nuitka), 
> and it should run nuitka.bat. I would guess that 
> the one without an extension is a Unix shell script 
> of some sort; have a look at it, see if it's a text 
> file that begins "#!/bin/sh" or similar. Most likely 
> the file sizes of nuitka and nuitka.bat will be 
> similar - of the order of hundreds of bytes, even, 
> as they're probably just invoking Python.

I tried that, and it still gives me the same message.
This is the Windows path, right?  In it, among other
paths, I have:

C:\Python27\Scripts\

(or without the last "\" also, though it should
not matter, right?)

The nuitka file starts with 

#!C:\Python27_32\python.exe

and is a Python script. It says in a docstring, 


This is the main program of Nuitka, it 
checks the options and then translates
one or more modules to a C++ source code 
using Python C/API in a build directory
compiles it to either an executable or an 
extension module that can contain other 
modules. """

I'm confused as to why it's not just a .py
file.  The nuitka.bat, aside from some
remarks, is this:

@echo off
setlocal

"%~dp0..\python" "%~dp0nuitka" %*

endlocal

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


Re: What can Nuitka do?

2014-06-27 Thread Chris Angelico
On Sat, Jun 28, 2014 at 3:40 PM, CM  wrote:
> The nuitka file starts with
>
> #!C:\Python27_32\python.exe
>
> and is a Python script. It says in a docstring,
>
> 
> This is the main program of Nuitka, it
> checks the options and then translates
> one or more modules to a C++ source code
> using Python C/API in a build directory
> compiles it to either an executable or an
> extension module that can contain other
> modules. """
>
> I'm confused as to why it's not just a .py
> file.

On a Unix system, you'd execute that with the name "nuitka". Although
it seems to have had your Windows Python executable's path patched in,
which presumably would be replaced with /usr/bin/python or something
on Unix.

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

And that's just calling on Python. I'm not familiar with the %~dp0
notation, but I'd say it's taking %0 (the name of the batch file) and
taking just the drive and path from it. This should work, once you
have your Windows path pointing to this directory.

The one thing I'm seeing here is that your PATH has
C:\Python27\Scripts\ but your script says C:\Python27_32\python.exe -
what is the actual directory name for your Python directory? Did you
rename it? It could be that something unrelated is causing problems.

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