Re: XML Binding

2015-09-04 Thread Lorenzo Sutton

Hi,

On 03/09/2015 21:54, Burak Arslan wrote:

Hello,

On 09/03/15 19:54, Palpandi wrote:

Hi All,

Is there any module available in python standard library for XML binding? If 
not, any other suggestions.


lxml is the right xml library to use. You can use lxml's objectify or Spyne.


I second lxml..

[...]

Which is good for parsing large file?

How large is large?

I have used lxml (coupled with pygtk) with very good results on XML 
files up to around 250Mb.


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


Re: Reading \n unescaped from a file

2015-09-04 Thread Friedrich Rentsch
My response was meant for the list, but went to Peter by mistake. So I 
repeat it with some delay:


On 09/03/2015 04:24 PM, Peter Otten wrote:

Friedrich Rentsch wrote:


On 09/03/2015 11:24 AM, Peter Otten wrote:

Friedrich Rentsch wrote:

I appreciate your identifying two mistakes. I am curious to know what
they are.

Sorry for not being explicit.


   substitutes = [self.table [item] for item in hits if item
in valid_hits] + []  # Make lengths equal for zip to work right

That looks wrong...

You are adding an empty list here. I wondered what you were trying to
achieve with that.
Right you are! It doesn't do anything. I remember my idea was to pad the 
substitutes list by one, because the list of intervening text segments 
is longer by one element and zip uses the least common length, 
discarding all overhang. The remedy was totally ineffective and, what's 
more, not needed, judging by the way the editor performs as expected.

   output = input

...and so does this.

That seems to be the only occurence of the name "input" in your code. Did
you mean "text" or do you really want to return the built-in?

Right you are again! I did mean text. I changed a few names to make them 
more suggestive, and apparently missed this one.


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


Python Package installation causing [Error 13] Permission Denied on Windows 7

2015-09-04 Thread moinakb
I am running Python 3.4 on Windows 7 and is facing [Error 13] Permission Denied 
while installing Python packages such as SciPy, NumPy etc; here are the facts 
that I tried but failed:
1.  I have admin privileges in my machine
2.  The folder where pip/easy_install copies contents have full write for 
the user
3.  I have tried Powershell with Unrestricted/RemoteSigned options
This is the line in *.py code that is causing exception
 
with open(target, 'wb') as f:
f.write(data)

What do I need to do to make this work? I am a windows domain user and 
obviously cannot run scripts with domain admin privileges.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Package installation causing [Error 13] Permission Denied on Windows 7

2015-09-04 Thread Laura Creighton
Over in the physics lab we have a big sign, which (translated) says:
'For windows 7, it is not enough to _be_ an admininstrator to
 install packages.  When opening up the command prompt you also
 have to select the 'run as administrator' option.'

No windows system here to test, but maybe this is your problem too.

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


Re: Python Package installation causing [Error 13] Permission Denied on Windows 7

2015-09-04 Thread moinakb
On Friday, September 4, 2015 at 3:07:19 PM UTC+5:30, moi...@gmail.com wrote:
> I am running Python 3.4 on Windows 7 and is facing [Error 13] Permission 
> Denied while installing Python packages such as SciPy, NumPy etc; here are 
> the facts that I tried but failed:
> 1.I have admin privileges in my machine
> 2.The folder where pip/easy_install copies contents have full write for 
> the user
> 3.I have tried Powershell with Unrestricted/RemoteSigned options
> This is the line in *.py code that is causing exception
>  
> with open(target, 'wb') as f:
> f.write(data)
> 
> What do I need to do to make this work? I am a windows domain user and 
> obviously cannot run scripts with domain admin privileges.

And Yes, I do run command prompt with Admin privileges as well, but still it 
fails
-- 
https://mail.python.org/mailman/listinfo/python-list


Permission denied error in download nltk_data...

2015-09-04 Thread Dwight GoldWinde
Please helpŠ(my apologizesŠI got a response to this before, but I CANNOT
find it now)Š

Using this code:

import nltk
nltk.download('maxent_treebank_pos_tagger¹)


I get this error:

[nltk_data] Downloading package maxent_treebank_pos_tagger to
[nltk_data] /Users/dwightgoldwindex/nltk_data...
Traceback (most recent call last):
  File "test short.py", line 18, in 
nltk.download('maxent_treebank_pos_tagger')
  File 
"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packag
es/nltk/downloader.py", line 664, in download
for msg in self.incr_download(info_or_id, download_dir, force):
  File 
"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packag
es/nltk/downloader.py", line 549, in incr_download
for msg in self._download_package(info, download_dir, force):
  File 
"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packag
es/nltk/downloader.py", line 604, in _download_package
os.mkdir(download_dir)

PermissionError: [Errno 13] Permission denied:
'/Users/dwightgoldwindex/nltk_data'


BIG SMILE...

Always, Dwight


www.3forliving.key.to (video playlist on YouTube)
www.couragebooks.key.to (all my books on Amazon)


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


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


Re: Permission denied error in download nltk_data...

2015-09-04 Thread Laura Creighton
In a message of Fri, 04 Sep 2015 18:50:11 +0800, Dwight GoldWinde writes:
>Please helpŠ(my apologizesŠI got a response to this before, but I CANNOT
>find it now)Š

https://mail.python.org/pipermail/python-list/2015-August/695546.html

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


Re: Permission denied error in download nltk_data...

2015-09-04 Thread Joel Goldstick
On Fri, Sep 4, 2015 at 8:11 AM, Laura Creighton  wrote:
> In a message of Fri, 04 Sep 2015 18:50:11 +0800, Dwight GoldWinde writes:
>>Please helpŠ(my apologizesŠI got a response to this before, but I CANNOT
>>find it now)Š
>
> https://mail.python.org/pipermail/python-list/2015-August/695546.html
>
> Laura
> --
> https://mail.python.org/mailman/listinfo/python-list


Dwight,

Please post in text only format.  You seem to be using rich text
format.  Your email program can be configured not to do that.

As to the error, what is the permission set for the file in question?
Is your program logged in as a different user?
-- 
Joel Goldstick
http://joelgoldstick.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Porting Python Application to a new linux machine

2015-09-04 Thread Grant Edwards
On 2015-09-04, Christian Gollwitzer  wrote:
> Am 03.09.15 um 16:32 schrieb Heli Nix:
>
>> I have my python scripts that use several python libraries such as
>> h5py, pyside, numpy
>>
>> In Windows I have an installer that will install python locally on
>> user machine and so my program gets access to this local python and
>> runs successfully.
>>
>> How can I do this in Linux ? ( I want to install python plus my
>> program on the user machine.) I do not want to use the user´s python
>> or to install python on the user´s machine on root.
>
> Another variant is the use of pyinstaller. It can generate a single 
> directory with a copy of Python and all needed libraries. You can copy 
> that to a different machine, and often it works - unless libc or some 
> very basic library is different. Beware that this pulls in half of your 
> system, so you'll end up with ~100 MB.

As an end-user of a number of largish Python applications on Linux, I
don't think any of them use anything like pyinstaller (and I would not
be very happy if they did -- I've likely got almost all of the
required libraries already installed, and I don't need another copy of
all that stuff on my machine that then has to be backed up).

The normal way to distribute even large Python apps with a lot of
required libraries is either as just the Python sources with a
'setup.py' file or as a package that tells the system what
dependancies and libraries are required.  If you don't want to ship
bare sources, the "right" way to distribute a Python app for Linux is
as an .rpm, .ebuild, or .deb.

-- 
Grant Edwards   grant.b.edwardsYow! An Italian is COMBING
  at   his hair in suburban DES
  gmail.comMOINES!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: packing unpacking depends on order.

2015-09-04 Thread Sven R. Kunze

On 04.09.2015 05:36, random...@fastmail.us wrote:
You haven't demonstrated that the RHS is affected by anything. The 
sample code in the original post of this thread behaves identically if 
the RHS is a simple tuple of (2, 1) [or (1, 2)] respectively. If you 
have another sample that shows different behavior please post it. 


You are right. I was reconstructing the example and see what exactly 
happened here. Not sure what made me think the assignment would be 
broken up into its parts. That's definitely not the case.


So, everything is fine. Side-effects happening on either side are 
unavoidable.


Best,
Sven
--
https://mail.python.org/mailman/listinfo/python-list


Re: Need Help w. PIP!

2015-09-04 Thread Chris Warrick
On 4 September 2015 at 15:14, Dennis Lee Bieber  wrote:
> On Fri, 4 Sep 2015 04:27:47 +0100, Mark Lawrence 
> declaimed the following:
>
>
>>python3 just doesn't exist on Windows, it's always python.exe or
>
> Really?
>
> [snip]
> 09/17/2013  12:37 AM40,448 python.exe
> 09/17/2013  12:37 AM40,448 python3.3.exe
> 09/17/2013  12:37 AM40,448 python3.exe
> 09/17/2013  12:37 AM40,960 pythonw.exe
> 09/17/2013  12:37 AM40,960 pythonw3.3.exe
> 09/17/2013  12:37 AM40,960 pythonw3.exe
> [snip]
>
> I did not create those variant files, they were part of my original
> install from ActiveState.

You are using an unofficial build of Python; the official one (from
python.org) does not have `python3.exe`.

-- 
Chris Warrick 
PGP: 5EAAEA16
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Need Help w. PIP!

2015-09-04 Thread Steve Burrus
On Thursday, September 3, 2015 at 5:20:17 PM UTC-5, Steve Burrus wrote:
> Well I hjave certainly noted more than once that pip is cont ained in Python 
> 3.4. But I am having the most extreme problems with simply typing "pip" into 
> my command prompt and then getting back the normal information on pip! I have 
> repeatedly downloaded [to my Desktop] that get-pip.py file then  ran it. I 
> even downloaded that easy-install.py and ran that but to no success! I have 
> all of the proper env. variables set. Can someone please help me?

Well I think that this is a Win 10 "thing" befcause using previous versions of 
Windows all I had to do was to type in "pip" to get the pip info. but  now 
apparently it's "python -m pip". Can someone please "set me straight" about the 
path I should be using if I have a "pathing" problem?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Need Help w. PIP!

2015-09-04 Thread Cody Piersall
On Fri, Sep 4, 2015 at 11:04 AM, Steve Burrus 
wrote:
>
> Well I think that this is a Win 10 "thing" befcause using previous
versions of Windows all I had to do was to type in "pip" to get the pip
info. but  now apparently it's "python -m pip". Can someone please "set me
straight" about the path I should be using if I have a "pathing" problem?

If you installed Python to the default location, you should be able to find
pip at "C:\Python34\Scripts\pip.exe".  If you
type "C:\Python34\Scripts\pip.exe" at the command prompt, you should be
able to find pip.  It seems pretty likely that your system path does not
include that folder.  You need to add that directory to your path if you
want to be able to just type "pip".

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


Re: Need Help w. PIP!

2015-09-04 Thread Steve Burrus
On Thursday, September 3, 2015 at 10:12:23 PM UTC-5, Mark Lawrence wrote:
> On 04/09/2015 02:04, Steve Burrus wrote:
> > On Thursday, September 3, 2015 at 7:06:27 PM UTC-5, Mark Lawrence wrote:
> >> On 03/09/2015 23:20, Steve Burrus wrote:
> >>> Well I hjave certainly noted more than once that pip is cont ained in 
> >>> Python 3.4. But I am having the most extreme problems with simply typing 
> >>> "pip" into my command prompt and then getting back the normal information 
> >>> on pip! I have repeatedly downloaded [to my Desktop] that get-pip.py file 
> >>> then  ran it. I even downloaded that easy-install.py and ran that but to 
> >>> no success! I have all of the proper env. variables set. Can someone 
> >>> please help me?
> >>
> >> As always my main and spare crystal balls are at the menders due to
> >> overwork, so I'll have to ask, what happened when you tried the 'pip',
> >> 'get-pip.py' and 'easy-install.py' commands?  What OS are you on?
> >>
> >> --
> >> My fellow Pythonistas, ask not what our language can do for you, ask
> >> what you can do for our language.
> >>
> >> Mark Lawrence
> >
> > I have tried the 'python get-pip.py' command over amnd over again in my 
> > command prompt and the 'python easy-install.py" command a little less. I 
> > swear I have set ALL of the env. variables correctly! My OS is Windows 10 
> > Beta Preview Build 10074.
> >
> 
> I'm awfully sorry, but my crystal balls still aren't back from the 
> menders, so let's try again.  Precisely explain what happened when you 
> tried the 'pip', 'get-pip.py' and 'easy-install.py' commands?  Could it 
> have been nuclear holocaust, ice cream dripping down your shirt front, 
> something like "pip isn't recognised as a Windows command", or whatever 
> the wording actually is, or even a Python traceback, in which case 
> please cut and paste it, in full, here?
> 
> -- 
> My fellow Pythonistas, ask not what our language can do for you, ask
> what you can do for our language.
> 
> Mark Lawrence

okay Mark her is what you haVE wanted of me :

"C:\Users\SteveB>py -m pip
Job information querying failed

C:\Users\SteveB>python -m pip

Usage:
  C:\Python34\python.exe -m pip  [options]

Commands:
  install Install packages.
  uninstall   Uninstall packages.
  freeze  Output installed packages in requirements format.
  listList installed packages.
  showShow information about installed packages.
  search  Search PyPI for packages.
  wheel   Build wheels from your requirements.
  helpShow help for commands.

General Options:
  -h, --help  Show help.
  --isolated  Run pip in an isolated mode, ignoring
  environment variables and user configuration.
  -v, --verbose   Give more output. Option is additive, and can be
  used up to 3 times.
  -V, --version   Show version and exit.
  -q, --quiet Give less output.
  --log Path to a verbose appending log.
  --proxy  Specify a proxy in the form
  [user:passwd@]proxy.server:port.
  --retries  Maximum number of retries each connection should
  attempt (default 5 times).
  --timeout  Set the socket timeout (default 15 seconds).
  --exists-action Default action when a path already exists:
  (s)witch, (i)gnore, (w)ipe, (b)ackup.
  --trusted-hostMark this host as trusted, even though it does
  not have valid or any HTTPS.
  --certPath to alternate CA bundle.
  --client-cert Path to SSL client certificate, a single file
  containing the private key and the certificate
  in PEM format.
  --cache-dirStore the cache data in .
  --no-cache-dir  Disable the cache.
  --disable-pip-version-check
  Don't periodically check PyPI to determine
  whether a new version of pip is available for
  download. Implied with --no-index."

so why is it that the "python -m pip" command works but not the "py -m pip" 
command? And someone said I have a "pathing" problem [with my pip installation] 
can you please help me with that? 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Need Help w. PIP!

2015-09-04 Thread Nick Sarbicki
In the cmd "echo %path%" and send us the output.

Also try to run "pip" as opposed to "python -m pip".

Nick.

On Fri, 4 Sep 2015 17:41 Steve Burrus  wrote:

> On Thursday, September 3, 2015 at 10:12:23 PM UTC-5, Mark Lawrence wrote:
> > On 04/09/2015 02:04, Steve Burrus wrote:
> > > On Thursday, September 3, 2015 at 7:06:27 PM UTC-5, Mark Lawrence
> wrote:
> > >> On 03/09/2015 23:20, Steve Burrus wrote:
> > >>> Well I hjave certainly noted more than once that pip is cont ained
> in Python 3.4. But I am having the most extreme problems with simply typing
> "pip" into my command prompt and then getting back the normal information
> on pip! I have repeatedly downloaded [to my Desktop] that get-pip.py file
> then  ran it. I even downloaded that easy-install.py and ran that but to no
> success! I have all of the proper env. variables set. Can someone please
> help me?
> > >>
> > >> As always my main and spare crystal balls are at the menders due to
> > >> overwork, so I'll have to ask, what happened when you tried the 'pip',
> > >> 'get-pip.py' and 'easy-install.py' commands?  What OS are you on?
> > >>
> > >> --
> > >> My fellow Pythonistas, ask not what our language can do for you, ask
> > >> what you can do for our language.
> > >>
> > >> Mark Lawrence
> > >
> > > I have tried the 'python get-pip.py' command over amnd over again in
> my command prompt and the 'python easy-install.py" command a little less. I
> swear I have set ALL of the env. variables correctly! My OS is Windows 10
> Beta Preview Build 10074.
> > >
> >
> > I'm awfully sorry, but my crystal balls still aren't back from the
> > menders, so let's try again.  Precisely explain what happened when you
> > tried the 'pip', 'get-pip.py' and 'easy-install.py' commands?  Could it
> > have been nuclear holocaust, ice cream dripping down your shirt front,
> > something like "pip isn't recognised as a Windows command", or whatever
> > the wording actually is, or even a Python traceback, in which case
> > please cut and paste it, in full, here?
> >
> > --
> > My fellow Pythonistas, ask not what our language can do for you, ask
> > what you can do for our language.
> >
> > Mark Lawrence
>
> okay Mark her is what you haVE wanted of me :
>
> "C:\Users\SteveB>py -m pip
> Job information querying failed
>
> C:\Users\SteveB>python -m pip
>
> Usage:
>   C:\Python34\python.exe -m pip  [options]
>
> Commands:
>   install Install packages.
>   uninstall   Uninstall packages.
>   freeze  Output installed packages in requirements
> format.
>   listList installed packages.
>   showShow information about installed packages.
>   search  Search PyPI for packages.
>   wheel   Build wheels from your requirements.
>   helpShow help for commands.
>
> General Options:
>   -h, --help  Show help.
>   --isolated  Run pip in an isolated mode, ignoring
>   environment variables and user configuration.
>   -v, --verbose   Give more output. Option is additive, and
> can be
>   used up to 3 times.
>   -V, --version   Show version and exit.
>   -q, --quiet Give less output.
>   --log Path to a verbose appending log.
>   --proxy  Specify a proxy in the form
>   [user:passwd@]proxy.server:port.
>   --retries  Maximum number of retries each connection
> should
>   attempt (default 5 times).
>   --timeout  Set the socket timeout (default 15 seconds).
>   --exists-action Default action when a path already exists:
>   (s)witch, (i)gnore, (w)ipe, (b)ackup.
>   --trusted-hostMark this host as trusted, even though it
> does
>   not have valid or any HTTPS.
>   --certPath to alternate CA bundle.
>   --client-cert Path to SSL client certificate, a single file
>   containing the private key and the
> certificate
>   in PEM format.
>   --cache-dirStore the cache data in .
>   --no-cache-dir  Disable the cache.
>   --disable-pip-version-check
>   Don't periodically check PyPI to determine
>   whether a new version of pip is available for
>   download. Implied with --no-index."
>
> so why is it that the "python -m pip" command works but not the "py -m
> pip" command? And someone said I have a "pathing" problem [with my pip
> installation] can you please help me with that?
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
 - Nick
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python handles globals badly.

2015-09-04 Thread tdev
Before responding (later) I have to add something additional first: 

Cause of complaints and while still exists and again and again:

When I mentioned maybe OO first than for also this reason
cause Python is a powerful language and supports procedural 
and OO features and many more.  
And cause a Python module is conceptually a singleton 
I recognized this as another feature of this language,
nearly similiar to an OO-construct. 

So it is Pyhton itself what brings me to OO thaughts.

>From knowing e.g Java as OO language I had no need to set 
such a keyword "global" to get write access to class members.

And now the main point: Cause all of the features and especially
the singleton construct, I could not believe that Python 
does nearly all for me but forces me then to use such 
a "ugly" keyword "global" in comparison to other OO languages.

So OO and other comparisons where only to demonstrate how it is 
in other languages (and maybe for OO developers to enter 
this talk more easily) but not written to give comments
going aside from this topic.

But I agree, I should have better never mentioned it.
Please lay  OO and sharing globals aside.

It is really about procedural programming and "global"-keyword only.
That said I will really give no longer any comments about this.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Need Help w. PIP!

2015-09-04 Thread Cody Piersall
On Fri, Sep 4, 2015 at 11:54 AM, Steve Burrus 
wrote:
> I mcan assure you that the Scripts folder is in both my Users and the
System path! I even haVE the folder
"C:\Python34\lib\site-packages\django\bin" in the Path. But I still cannot
simply type out "pip" without getti ng the usual error message!
>
> On Fri, Sep 4, 2015 at 11:35 AM, Cody Piersall 
wrote:
>> If you installed Python to the default location, you should be able to
find pip at "C:\Python34\Scripts\pip.exe".  If you type
"C:\Python34\Scripts\pip.exe" at the command prompt, you should be able to
find pip.  It seems pretty likely that your system path does not include
that folder.  You need to add that directory to your path if you want to be
able to just type "pip".
>>
>> Cody
>
>

(Responding on-list)

I know you keep assuring us that your path is great, but we're not going to
stop talking about it until you prove it to us, unfortunately.  If you do
this, you will prove it to us.

In cmd, type "echo %PATH%", and then copy and paste both the command and
the output.  Like this:

D:\Dropbox (Univ. of Oklahoma)\toshiba\hail\data>echo %PATH%
C:\tools\ConEmu\ConEmu;C:\tools\ConEmu;C:\ProgramData\Oracle\Java\javapath;C:\tools;C:\MinGW\msys\1.0\bin;C:\MinGW\bin;C:\Python34\;C:\Python34\Scripts;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program
Files (x86)\IVI Foundation\VISA\WinNT\Bin\;C:\Program Files\IVI
Foundation\VISA\Win64\Bin\;C:\Program Files (x86)\IVI
Foundation\VISA\WinNT\Bin;C:\Program Files (x86)\IVI
Foundation\IVI\bin;C:\Program Files\IVI Foundation\IVI\bin;C:\Program
Files\TortoiseHg\;C:\Program Files (x86)\Git\cmd;C:\Program
Files\MATLAB\R2014b\runtime\win64;C:\Program
Files\MATLAB\R2014b\bin;C:\HashiCorp\Vagrant\bin;C:\Program Files
(x86)\NSIS;C:\MinGW\msys\1.0;;C:\Program Files (x86)\Heroku\bin;C:\Program
Files (x86)\git\cmd;C:\Users\pier3595\AppData\Local\atom\bin


While you're at it, go ahead and type "pip" and show us the output of that
too.  Use copy and paste to do it.

If you're not sure how to copy and paste with cmd, follow the instructions
here:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/windows_dos_copy.mspx?mfr=true
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Need Help w. PIP!

2015-09-04 Thread Cody Piersall
On Fri, Sep 4, 2015 at 12:40 PM, Steve Burrus 
wrote:
>
> "C:\Python34\Tools\Scripts>python checkpip.py
> The latest version of setuptools on PyPI is 18.2, but ensurepip has 12.0.5
> The latest version of pip on PyPI is 7.1.2, but ensurepip has 6.0.8"
>
> I ran this pythpon file, checkpip.py, and got the results above. Does
that contribute to my inability to type "pip" normally?
>

Nah, I get the same thing.

> On Fri, Sep 4, 2015 at 12:22 PM, Steve Burrus 
wrote:
>>
>> well I jhave already done this for Nick [Sarbicki] but here is the
result of echo %path% :
>>
>> "echo %path%
>>
>>
C:\Python34;C:\Python34\python.exe;C:\Python34\Scripts;C:\Python34\Lib\site-packages\django\bin;C:\oraclexe\app\oracle\product\11.2.0\server\bin;C:\ProgramData\Oracle\Java\javapath;C:\Users\SteveB;C:\Users\SteveB;C:\OracleInst\app\oracle\product\11.2.0\server\bin;C:\Program
Files\Broadcom\Broadcom 802.11\Driver;C:\Program Files\Common
Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common
Files\Microsoft Shared\Windows Live;c:\Program Files (x86)\AMD
APP\bin\x86_64;c:\Program Files (x86)\AMD
APP\bin\x86;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;c:\Program
Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files
(x86)\Common Files\Roxio Shared\12.0\DLLShared\ ;C:\Program Files
(x86)\Windows Live\Shared;C:\Program Files\Microsoft SQL
Server\110\Tools\Binn\;C:\Go\bin;C:\Program Files\Microsoft SQL
Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\Client
SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL
Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL
Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL
Server\120\Tools\Binn\ManagementStudio\;C:\Program Files\Google\Cloud
SDK\google-cloud-sdk\bin;C:\Users\SteveB\.dnx\bin;C:\Program
Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\bin;C:\bin;C:\Program
Files\nodejs\;C:\Program Files (x86)\Git\cmd;C:\Program Files
(x86)\Brackets\command;C:\Program Files (x86)\Subversion\bin;C:\Program
Files (x86)\QuickTime\QTSystem\;C:\Program Files\Microsoft\Web Platform
Installer\;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5.4
>>
>>
 Steve Burrus

Your path looks right to me.  Do you have pip.exe in C:\Python34\Scripts?

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


Re: Need Help w. PIP!

2015-09-04 Thread Cody Piersall
On Fri, Sep 4, 2015 at 12:50 PM, Steve Burrus 
wrote:
>
> "Do you have pip.exe in C:\Python34\Scripts?" well I remember seeing it
in thar folder the other day but not now! D oes this mean I have to
re-install python or just pip?

Please respond to the list as well as the person you're actually talking
to.  It works out better for everyone that way.   (You should just have to
"reply all" instead of "reply").

You just need to reinstall pip:  type

python -m pip install --upgrade pip

and you're set.

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


Re: Python handles globals badly.

2015-09-04 Thread Sven R. Kunze

On 04.09.2015 18:55, t...@freenet.de wrote:

 From knowing e.g Java as OO language I had no need to set
such a keyword "global" to get write access to class members.


It is true and I really dislike Java for having this. Please consider this

class MyClass:
@classmethod
def method(cls):attribute = 'a' cls.myattribute = 1234


As you see, even when using a class for the purpose, you still need to 
reference the class object somehow.



And now the main point: Cause all of the features and especially
the singleton construct, I could not believe that Python
does nearly all for me but forces me then to use such
a "ugly" keyword "global" in comparison to other OO languages.


It is ugly, that is true. Would something like this help you?

@modulemethod
def method(mod):
attribute = 'a'
mod.myattribute = 123


Works like classmethod but on module level. You still need to explicitly 
specify from which namespace you want myattribute but that's the Python 
way I think. It applies to instance methods, class methods and all other 
types of Python code.



But I agree, I should have better never mentioned it.
Please lay  OO and sharing globals aside.

It is really about procedural programming and "global"-keyword only.
That said I will really give no longer any comments about this.


That is sad. :(
I at least would like to know if my suggestion would help? :)

Best,
Sven

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


Re: Python handles globals badly.

2015-09-04 Thread tdev
Now I want reflecting the latest answers:


I think mostly everything is said.
Maybe you skip directly to my conclusion on the end.


--

Nevertheless I want grasp some points out
where I think I could give a respective answer:

  
"You are shifting declaration from one to another place"

I would not say so: 
maybe it is a special prefix, but that you write once 
and not in every function (with additonal at least one "ugly" line of code). 
See no shifting here.
And I think it cannot be duplicated elswhere cause you are in
your single module's namespace. 
See no conflicts here.


"You would create than all in one scope"
(or "You would create namespace vulnerabilities")

I would not say so:  
An enclosed code block has still its own scope.
But if there is a global module var (e.g. recognized by a distinct name)
inside this block than this var is from scope global.
See no conflicts here.


"Learn better Python"
I am sure I am not alone (although the thread seems to isolate my opinion)
And you maybe have recognized I have accepted that there is a need for "global".
But admit I have to chew hard. 
See my conclusion. 


"Java have it ugly too"
I would not say so:  

The examples providing with one var and one function does
not reflecting real scenarios.

Guess mostly classes have about 10 members and 10 functions.
Each member about 10 chars long with 10 lines of code per function.

seeing the global var inline is more readable than
looking on the top of the function if the var is global or not
+ the addtional lines of code onyl cause making it global.

I dislike @ too (also in Java).

See the contamination in that point still in Python.

--



Conclusion:
---

I think we can agree 

- that there are (unfortunately) low-level issues
  that makes the removing of "global" impossible. !?

- and there are also special (dynamic) programming constructs 
  where a keyword "global" makes sense and should be available !?


I think for a scripting language this would be a good solution:
when used then the compiler should definitive look in the global namespace,
otherwise the compiler has some "magic" to distinct global from local
(probably simply by varname and scope of birth) 



And yes it is not that I want change Python mantras.
But Python philospy is so far I know:
"There's a most understandable way to do something and that is how it should be 
done"

But that says not: Do not change things that makes the life easier for a 
developer
   (escpecially who wants to do simple or powerful 
procedural/functional scripting).


So for me there are 6 things that is somehow "masochistic" in Python
cause with all its powerful features it is remarkable that it is not addable.

So, If I had the power I would include following features
(especially as we talk about scripting and cause why not (?), 
it would not harm anyone who does not want to use it (!)):

all is optional (so hardcore Pythonier would probabyl deny to make use of it):

1. optional keyword "global" (if technical possible)
2. switch statement
3. less restrictive indentation 
   (as if it would really matter forgetting an empty space somewhere
if something is intended more right than is the context clear for me)
4. universal scope 
5. goto label
6- "include" script statement (extending namespace to another script, like PHP)


I think this would make Python even more popular than it is now.
Not to say: I would really love it then.



Last but not least: 
Why does javascript, as sripting language too, need not such things like
a keyword "global". It also very powerful language with dynamic binding, OO, ...

This is my question now.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python handles globals badly.

2015-09-04 Thread Ian Kelly
On Fri, Sep 4, 2015 at 1:11 PM,   wrote:
> 6- "include" script statement (extending namespace to another script, like 
> PHP)

def include(filename):
exec(open(filename).read())

> Last but not least:
> Why does javascript, as sripting language too, need not such things like
> a keyword "global". It also very powerful language with dynamic binding, OO, 
> ...

I thought you didn't want to talk about comparisons to other languages. :-P

Javascript uses the same stupid system that Lua does, where
*everything* is automatically global/nonlocal unless you specifically
declare it as local.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python handles globals badly.

2015-09-04 Thread Ian Kelly
On Fri, Sep 4, 2015 at 1:48 PM, Ian Kelly  wrote:
> On Fri, Sep 4, 2015 at 1:11 PM,   wrote:
>> 6- "include" script statement (extending namespace to another script, like 
>> PHP)
>
> def include(filename):
> exec(open(filename).read())

Sorry, that doesn't work because it takes locals from the include
function. You probably need something more like this:

def include(filename, globals):
exec(open(filename).read(), globals)

To be called like:

include("foo.py", globals())

If you want to get fancy you could probably have include inspect the
stack to pull the globals from the parent stack frame instead of
explicitly passing them in.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Need Help w. PIP!

2015-09-04 Thread Mark Lawrence

On 04/09/2015 17:04, Steve Burrus wrote:

On Thursday, September 3, 2015 at 5:20:17 PM UTC-5, Steve Burrus wrote:

Well I hjave certainly noted more than once that pip is cont ained in Python 3.4. But I 
am having the most extreme problems with simply typing "pip" into my command 
prompt and then getting back the normal information on pip! I have repeatedly downloaded 
[to my Desktop] that get-pip.py file then  ran it. I even downloaded that easy-install.py 
and ran that but to no success! I have all of the proper env. variables set. Can someone 
please help me?


Well I think that this is a Win 10 "thing" befcause using previous versions of Windows all I had to do was to type in 
"pip" to get the pip info. but  now apparently it's "python -m pip". Can someone please "set me 
straight" about the path I should be using if I have a "pathing" problem?



Read 
https://docs.python.org/3/using/windows.html#excursus-setting-environment-variables 
and if you can install the Rapid Environment Editor 
http://www.rapidee.com/en/about


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

Mark Lawrence

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


Re: Need Help w. PIP!

2015-09-04 Thread Mark Lawrence

On 04/09/2015 17:44, Nick Sarbicki wrote:

In the cmd "echo %path%" and send us the output.

Also try to run "pip" as opposed to "python -m pip".

Nick.



Will you please stop top posting, it's driving me nuts, thank you.

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

Mark Lawrence

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


Accumulating points in batch for sending off

2015-09-04 Thread Victor Hooi
Hi,

I'm using Python to parse out  metrics from logfiles, and ship them off to a 
database called InfluxDB, using their Python driver 
(https://github.com/influxdb/influxdb-python).

With InfluxDB, it's more efficient if you pack in more points into each message.

Hence, I'm using the grouper() recipe from the itertools documentation 
(https://docs.python.org/3.6/library/itertools.html), to process the data in 
chunks, and then shipping off the points at the end of each chunk:

  def grouper(iterable, n, fillvalue=None):
  "Collect data into fixed-length chunks or blocks"
  # grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx
  args = [iter(iterable)] * n
  return zip_longest(fillvalue=fillvalue, *args)
  
  for chunk in grouper(parse_iostat(f), 500):
  json_points = []
  for block in chunk:
  if block:
  try:
  for i, line in enumerate(block):
  # DO SOME STUFF
  except ValueError as e:
  print("Bad output seen - skipping")
  client.write_points(json_points)
  print("Wrote in {} points to InfluxDB".format(len(json_points)))


However, for some parsers, not every line will yield a datapoint.

I'm wondering if perhaps rather than trying to chunk the input, it might be 
better off just calling len() on the points list each time, and sending it off 
when it's ready. E.g.:

#!/usr/bin/env python3

json_points = []
_BATCH_SIZE = 2

for line_number, line in enumerate(open('blah.txt', 'r')):
if 'cat' in line:
print('Found cat on line {}'.format(line_number + 1 ))
json_points.append(line_number)
print("json_points contains {} points".format(len(json_points)))
if len(json_points) >= _BATCH_SIZE:
# print("json_points contains {} points".format(len(json_points)))
print('Sending off points!')
json_points = []

print("Loop finished. json_points contains {} 
points".format(len(json_points)))
print('Sending off points!')

Does the above seem reasonable? Any issues you see? Or are there any other more 
efficient approaches to doing this?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python handles globals badly.

2015-09-04 Thread Vladimir Ignatov
> To me, marking a variable as global in a large number of functions is
> a code smell that indicates that you're probably overusing globals.
> Lua is an example of a language that takes the opposite approach: in
> Lua, every variable is global unless you explicitly mark it as local.
> Lua is a fine language overall, but that is one of my pet peeves with

I had some experience programming in Lua and I'd say - that language
is bad example to follow.
Indexes start with 1  (I am not kidding)
Single data type ("table") which could suddenly flip from "list" to
"map" because you deleted one item.
Has objects but has no classes.
and so on...

Vladimir

http://itunes.apple.com/us/app/python-code-samples/id1025613117
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python handles globals badly.

2015-09-04 Thread Chris Angelico
On Sat, Sep 5, 2015 at 5:11 AM,   wrote:
> 1. optional keyword "global" (if technical possible)

As we've been saying in this thread, the problem isn't the
technicalities of implementation, but the ambiguity of syntax. To
eliminate the global statement, you need to either (a) declare all
your globals at module level, the way C-like languages do, or (b)
adorn every usage with either a magic naming convention or a
dot-lookup.

If you want the first one, well, there are languages like that, and
you're welcome to use those. For the latter, it's easy enough to do
something like this:

import types
_g = types.SimpleNamespace()

def accumulate(x):
_g.accum += x
return _g.accum

Look, Ma! No global statement!

> 2. switch statement

Check out the suggestions in PEP 3103. There are some plausible
options, and the known problems with them.

> 3. less restrictive indentation
>(as if it would really matter forgetting an empty space somewhere
> if something is intended more right than is the context clear for me)

In the face of ambiguity, refuse the temptation to guess. Can you
imagine the horrors if Python started guessing at indentation?

count = 0
for file in files:
for line in open(file):
process(line)
count += 1

It's obvious that process(line) goes inside the nested loop. What
about the counter? Literally the only difference between "count the
lines processed" and "count the files processed" is the indentation of
one line. You could make these kinds of things unambiguous, but only
by adding some other rule, like "always have a blank line at the end
of a loop", which would be just as restrictive.

> 4. universal scope

You can inject stuff into the built-ins, is that good enough?

> 5. goto label

Already exists! http://entrian.com/goto/

> 6- "include" script statement (extending namespace to another script, like 
> PHP)

Ugh. There are a number of ways you can describe the semantics of
"include", and you picked what is, in my opinion, the very worst.
PHP's include operation switches back to HTML mode, which isn't itself
unreasonable, but it highlights the fact that "starting in HTML mode"
is stupid for any system of the size and complexity to want include();
but notably, it is *not* a simple text inclusion. You can include at
top level, and that works fine (I think). You can include inside a
function, and that mostly works (but it's not the same as dumping the
source code in at that point). But you can't, for some bizarre reason,
include inside a class definition. Not at all.

Fortunately, it's easy enough to preprocess source code. And if you
want that functionality in Python, that's probably the best way to do
it, too. The only special I can think of would be to indent the file
to the exact level that the #include directive is indented. (And yes,
I think using "#include" in Python would be correct; that way, syntax
highlighters read it as a comment.)

Most of what you want can be done already. If you want the language to
grow these features, you need to explain how the feature is different
from what can already be done.

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


Re: Need Help w. PIP!

2015-09-04 Thread Rob Hills
On 05/09/15 01:47, Cody Piersall wrote:
> > On Fri, Sep 4, 2015 at 12:22 PM, Steve Burrus
> mailto:steveburru...@gmail.com>> wrote:
>
<..>
> >> "echo %path%
> >>
> >> C:\Python34;C:\Python34\python.exe;C:\Python34\Scripts;

It's a long time since I last used Windoze in anger, but that second
path entry (C:\Python34\python.exe;) looks wrong to me.  Unless Windoze
has changed recently, you shouldn't have a program name in your path. 
IIRC, that's going to break all path entries that follow it, so it could
be the cause of your problem (ie the "C:\Python34\Scripts;" part won't
be accessible.

Perhaps try deleting the "C:\Python34\python.exe;" entry from your PATH
environment variable and see what happens.

HTH,

-- 
Rob Hills
Waikiki, Western Australia

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


Re: Need Help w. PIP!

2015-09-04 Thread MRAB

On 2015-09-05 01:35, Rob Hills wrote:

On 05/09/15 01:47, Cody Piersall wrote:

> On Fri, Sep 4, 2015 at 12:22 PM, Steve Burrus
mailto:steveburru...@gmail.com>> wrote:


<..>

>> "echo %path%
>>
>> C:\Python34;C:\Python34\python.exe;C:\Python34\Scripts;


It's a long time since I last used Windoze in anger, but that second
path entry (C:\Python34\python.exe;) looks wrong to me.  Unless Windoze
has changed recently, you shouldn't have a program name in your path.
IIRC, that's going to break all path entries that follow it, so it could
be the cause of your problem (ie the "C:\Python34\Scripts;" part won't
be accessible.

Perhaps try deleting the "C:\Python34\python.exe;" entry from your PATH
environment variable and see what happens.


It should be a list of folder paths. Including a file path doesn't
appear to break it, and, in fact, I'd be surprised if it did; it should
just keep searching, much like it should if the folder were missing.

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


Re: Python handles globals badly.

2015-09-04 Thread Michael Torrie
On 09/04/2015 06:27 PM, Chris Angelico wrote:
> If you want the first one, well, there are languages like that, and
> you're welcome to use those. For the latter, it's easy enough to do
> something like this:
> 
> import types
> _g = types.SimpleNamespace()
> 
> def accumulate(x):
> _g.accum += x
> return _g.accum
> 
> Look, Ma! No global statement!

Since most of the time for me when I need a global, I need it to be an
app global (more than just one module) and I use it to store
configuration.  So I just use another module for that.

import my_global_module as _g

_g.some_setting = 5

I get the impression, thought, that our esteemed poster is still trying
to battle the Java windmill, but in Python now and will never accept
anything we try to tell him about the Python way.  Python does have its
warts, but often attempts to fix the warts would just make things a lot
worse.  So I accept them as part of Python's character and try to use
them to my advantage.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python handles globals badly.

2015-09-04 Thread Chris Angelico
On Sat, Sep 5, 2015 at 11:42 AM, Michael Torrie  wrote:
> On 09/04/2015 06:27 PM, Chris Angelico wrote:
>> If you want the first one, well, there are languages like that, and
>> you're welcome to use those. For the latter, it's easy enough to do
>> something like this:
>>
>> import types
>> _g = types.SimpleNamespace()
>>
>> def accumulate(x):
>> _g.accum += x
>> return _g.accum
>>
>> Look, Ma! No global statement!
>
> Since most of the time for me when I need a global, I need it to be an
> app global (more than just one module) and I use it to store
> configuration.  So I just use another module for that.
>
> import my_global_module as _g
>
> _g.some_setting = 5

Yeah. Comes to the same thing; if you use a dotted lookup, it's not
assigning to the global.

Of course, you still have all the other concerns about globals. You've
just buried them behind a level of indirection.

> I get the impression, thought, that our esteemed poster is still trying
> to battle the Java windmill, but in Python now and will never accept
> anything we try to tell him about the Python way.  Python does have its
> warts, but often attempts to fix the warts would just make things a lot
> worse.  So I accept them as part of Python's character and try to use
> them to my advantage.

Indeed. The key to being a good programmer is not "write your code
despite the language you're using", but "write the code in the
language you're using".

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


Re: Need Help w. PIP!

2015-09-04 Thread Rob Hills
On 05/09/15 08:55, MRAB wrote:
> On 2015-09-05 01:35, Rob Hills wrote:
>> On 05/09/15 01:47, Cody Piersall wrote:
>>> > On Fri, Sep 4, 2015 at 12:22 PM, Steve Burrus
>>> mailto:steveburru...@gmail.com>> wrote:
>>>
>> <..>
>>> >> "echo %path%
>>> >>
>>> >> C:\Python34;C:\Python34\python.exe;C:\Python34\Scripts;
>>
>> It's a long time since I last used Windoze in anger, but that second
>> path entry (C:\Python34\python.exe;) looks wrong to me.  Unless Windoze
>> has changed recently, you shouldn't have a program name in your path.
>> IIRC, that's going to break all path entries that follow it, so it could
>> be the cause of your problem (ie the "C:\Python34\Scripts;" part won't
>> be accessible.
>>
>> Perhaps try deleting the "C:\Python34\python.exe;" entry from your PATH
>> environment variable and see what happens.
>>
> It should be a list of folder paths. Including a file path doesn't
> appear to break it, and, in fact, I'd be surprised if it did; it should
> just keep searching, much like it should if the folder were missing.

You're probably right, but my recollection of Windoze is that it was
very easily broken, hence my migration to Linux many moons ago.  I
reckon it wouldn't hurt to try getting rid of the invalid path entry anyway.

Cheers,

-- 
Rob Hills
Waikiki, Western Australia

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


Re: Hello

2015-09-04 Thread Rustom Mody
On Thursday, September 3, 2015 at 10:37:04 AM UTC+5:30, Phuong Phan wrote:
> Hi Python community,

Hi Phuong Phan

> I am new to Python and currently taking one online course of computer science 
> and programming using Python. I really like Python because it is simple and 
> clarity but powerful to me.
> I just joint Python mailing list and i hope to enjoy Python programming 
> discussion with you all.
> Thank you, 
> phuong phan

You're welcome!

You may find the tutor list more useful for you if you are just beginning
https://mail.python.org/mailman/listinfo/tutor
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Need Help w. PIP!

2015-09-04 Thread Steve Burrus
On Friday, September 4, 2015 at 9:20:14 PM UTC-5, Rob Hills wrote:
> On 05/09/15 08:55, MRAB wrote:
> > On 2015-09-05 01:35, Rob Hills wrote:
> >> On 05/09/15 01:47, Cody Piersall wrote:
> >>> > On Fri, Sep 4, 2015 at 12:22 PM, Steve Burrus
> >>> mailto:steveburru...@gmail.com>> wrote:
> >>>
> >> <..>
> >>> >> "echo %path%
> >>> >>
> >>> >> C:\Python34;C:\Python34\python.exe;C:\Python34\Scripts;
> >>
> >> It's a long time since I last used Windoze in anger, but that second
> >> path entry (C:\Python34\python.exe;) looks wrong to me.  Unless Windoze
> >> has changed recently, you shouldn't have a program name in your path.
> >> IIRC, that's going to break all path entries that follow it, so it could
> >> be the cause of your problem (ie the "C:\Python34\Scripts;" part won't
> >> be accessible.
> >>
> >> Perhaps try deleting the "C:\Python34\python.exe;" entry from your PATH
> >> environment variable and see what happens.
> >>
> > It should be a list of folder paths. Including a file path doesn't
> > appear to break it, and, in fact, I'd be surprised if it did; it should
> > just keep searching, much like it should if the folder were missing.
> 
> You're probably right, but my recollection of Windoze is that it was
> very easily broken, hence my migration to Linux many moons ago.  I
> reckon it wouldn't hurt to try getting rid of the invalid path entry anyway.
> 
well everyone there must be sometjhing about upgrading Python up to version 3.5 
rc because everything works just fine now, beyond my wildest dreams! I am even 
able now to type in "pip" and get the usual info. on it and I have connected to 
the Django server and configured the admin so thanx for eveyone who tried to 
help me. 
-- 
https://mail.python.org/mailman/listinfo/python-list


Program in or into (was Python handles globals badly)

2015-09-04 Thread Rustom Mody
On Saturday, September 5, 2015 at 7:24:47 AM UTC+5:30, Chris Angelico wrote:
> Indeed. The key to being a good programmer is not "write your code
> despite the language you're using", but "write the code in the
> language you're using".
> 

A thought experiment for you Chris!

Here's mergesort written in various languages
http://rosettacode.org/wiki/Sorting_algorithms/Merge_sort

You could look at the java if you like but I think C# takes the cake.
And of course also there's the python

Now the thought experiment:

For some reason you need to code in C#
[You need to do this part of the experiment honestly!!]

Would you write the C# code?
Or would you write the python-ish code in C# ?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Program in or into (was Python handles globals badly)

2015-09-04 Thread Chris Angelico
On Sat, Sep 5, 2015 at 1:18 PM, Rustom Mody  wrote:
> Now the thought experiment:
>
> For some reason you need to code in C#
> [You need to do this part of the experiment honestly!!]
>
> Would you write the C# code?
> Or would you write the python-ish code in C# ?

As I'm not familiar with C#, I'd probably end up writing Python-style
code in C#. But I wouldn't then complain that C# isn't sufficiently
like Python; if I want Python, I know where to find it.

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


Re: Need Help w. PIP!

2015-09-04 Thread eryksun
On Fri, Sep 4, 2015 at 11:35 AM, Steve Burrus  wrote:
>
> "C:\Users\SteveB>py -m pip
> Job information querying failed

You're using build 10074, an old build of Windows 10 that had a buggy
Job object API. This was fixed in build 10159:

http://bugs.python.org/issue24127

FYI, the py launcher runs Python in a job that's configured to kill
Python if the the launcher gets killed. This is necessary if py.exe is
started by a console shell such as cmd.exe or powershell.exe. The
shell waits on py.exe, not python.exe. If the job didn't kill
python.exe, then Python would compete with the shell for console
input.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Need Help w. PIP!

2015-09-04 Thread eryksun
On Fri, Sep 4, 2015 at 5:10 PM, Steve Burrus  wrote:
> so what is my hopefully sinple solution anyway? i do n't see myself anytime
> soon getting off of Build 10074 of Win 10.

Script wrappers such as pip.exe are simple versions of the py launcher
that execute an embedded script. For example, here's the script
embedded in pip.exe on my system:

#!"C:\Program Files\Python34\python.exe"
# -*- coding: utf-8 -*-
import re
import sys
from pip import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

So, as with py.exe, the child python.exe process has to be assigned to
a job object. That won't work as long as you're using build 10074 of
Windows 10. But you can still run pip using `python -m pip`.

Also, since the py launcher doesn't work on your system, you'll have
to ensure that scripts are associated with python.exe / pythonw.exe
instead of py.exe / pyw.exe. If you installed for all users you can do
that in an elevated command prompt (cmd.exe) using the ftype command:

ftype Python.File="C:\Python34\python.exe" "%1" %*
ftype Python.NoConFile="C:\Python34\pythonw.exe" "%1" %*
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Need Help w. PIP!

2015-09-04 Thread Steve Burrus
Well actually pip [at least a foolder called pip] is in the
"C:\lib\site-packages" folder but not in any Scripts folder. Should it be
in the Scripts folder?

On Fri, Sep 4, 2015 at 1:03 PM, Cody Piersall 
wrote:

>
>
> On Fri, Sep 4, 2015 at 12:50 PM, Steve Burrus 
> wrote:
> >
> > "Do you have pip.exe in C:\Python34\Scripts?" well I remember seeing it
> in thar folder the other day but not now! D oes this mean I have to
> re-install python or just pip?
>
> Please respond to the list as well as the person you're actually talking
> to.  It works out better for everyone that way.   (You should just have to
> "reply all" instead of "reply").
>
> You just need to reinstall pip:  type
>
> python -m pip install --upgrade pip
>
> and you're set.
>
> Cody
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Need Help w. PIP!

2015-09-04 Thread Steve Burrus
*so what is my hopefully sinple solution anyway? i do n't see myself
anytime soon getting off of Build 10074 of Win 10. i don't have pip in the
Scripts folder where I was told it should be. I was thinking of doing a
complete disinstall/reinstall of Python 3.4 to see if that helps.  *


*On Fri, Sep 4, 2015 at 4:50 PM, eryksun > wrote:*
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *On Fri, Sep 4, 2015 at 11:35 AM, Steve Burrus  > wrote: > > "C:\Users\SteveB>py -m pip > Job
> information querying failed You're using build 10074, an old build of
> Windows 10 that had a buggy Job object API. This was fixed in build 10159:
> http://bugs.python.org/issue24127  FYI,
> the py launcher runs Python in a job that's configured to kill Python if
> the the launcher gets killed. This is necessary if py.exe is started by a
> console shell such as cmd.exe or powershell.exe. The shell waits on py.exe,
> not python.exe. If the job didn't kill python.exe, then Python would
> compete with the shell for console input. *
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Need Help w. PIP!

2015-09-04 Thread eryksun
On Fri, Sep 4, 2015 at 10:07 PM, Steve Burrus  wrote:
> well everyone there must be sometjhing about upgrading Python up to version 
> 3.5 rc
> because everything works just fine now, beyond my wildest dreams! I am even 
> able
> now to type in "pip" and get the usual info. on it and I have connected to 
> the Django
> server and configured the admin so thanx for eveyone who tried to help me.

I just tested running pip.exe on a VM with Windows 10, build 10074. It
surprised me that it worked, so I checked the source code of Vinay's
[simple launcher][1]. Apparently the simpler launcher merely asserts
that creating the job object succeeds, so it will only fail in a debug
build. (See run_child in launcher.c). Depending on the nature of the
script it could be confusing if there's no job object and the launcher
gets killed. This leaves python.exe and the shell competing for
console input. That said, it shouldn't really matter for a simple
program such as pip.

But the full py.exe launcher used by Python always fails if creating
the job object doesn't succeed. (Oddly, it doesn't fail if *assigning*
the child to the job fails; I guess because Windows 7 lacks support
for job hierarchies, but still, it makes no sense to care about
creating something that you don't care about using.) So for build
10074 of Windows 10, ensure the filetypes for .py and .pyw scripts
(installed as Python.File and Python.NoConFile) run python.exe and
pythonw.exe instead of py.exe and pyw.exe. Otherwise you won't be able
to run scripts directly at the command prompt or by double clicking
them in Explorer.

[1]: https://bitbucket.org/vinay.sajip/simple_launcher/src
-- 
https://mail.python.org/mailman/listinfo/python-list