Python Help

2014-10-15 Thread Jeffe
Hi,

I am looking for anyone who knows python (C++ is also ok) well enough to write 
a basic script login registration and tws ib api connected. Looking to build a 
asset/security trading platform and have investors interested but want to see 
it operational first. 

Looking for a something basic yet operational, fee based or we can discuss 
equity if succesfully funded. Have some Big people interested with a solid 
business framework. Just need the software to show and its on..

Similar to this...https://www.youtube.com/watch?v=Bu0kpU-ozaw

We have Solid trading strategies but investors want to see the software 
operational first before integrating our strategies (and their funds) so we may 
collect trading fees while we run our patterns simultaneously


Looking forward to hearing back from you,

Jeff
jeffevalen...@gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Help

2014-10-15 Thread Chris Angelico
On Wed, Oct 15, 2014 at 4:57 PM, Jeffe jeffevalen...@gmail.com wrote:
 Looking for a something basic yet operational, fee based or we can discuss 
 equity if succesfully funded. Have some Big people interested with a solid 
 business framework. Just need the software to show and its on..


Unfortunately, the Python Job Board isn't currently active, so I can't
point you there. But you may find that Stack Overflow Careers will
help:

http://careers.stackoverflow.com/

Good luck! There's people out there who can do what you're wanting.
It's just a matter of finding them!

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


reading output from a .sol file

2014-10-15 Thread varun7rs
Hello everyone,

I have a .sol file at my hand and I wish to make it an xml file so that its a 
bit more convenient to read and skim off data from an xml file. But to do that, 
I need to write a function to read the values in the .sol file. What I intend 
is when I read the line z_ something, i need to have a request tree and based 
on the number that follows the underscore, i will update the id of the 
request...but for the f_0_0(0,1)_(1,5) category, its a bit tricky. excluding 
the first few, when I read the contents in the brackets, the first set (0,1) 
means the virtual link and i update the xml with this and the second set (1,5) 
indicates the physical link on which the virtual link is placed. This is where 
I need your help. I tried writing one but I found it too hard.

Hopefully you guys help me out or point me to the relevant sources for more 
information.
Sorry for the trouble and thanks a lot


z_0  1.00
x_0_0_1  1.00
x_0_1_5  1.00
x_0_2_20 1.00
x_0_3_21 1.00
x_0_4_8  1.00
f_0_0(0,1)_(1,5) 33.80
f_0_1(1,2)_(5,9) 51.10
f_0_1(1,2)_(9,20)51.10
f_0_2(2,3)_(2,21)33.30
f_0_2(3,2)_(2,22)33.30
f_0_2(3,2)_(18,19)   2.90
f_0_2(2,3)_(18,25)   2.90
f_0_2(3,2)_(19,20)   2.90
f_0_2(2,3)_(20,22)   33.30
f_0_2(3,2)_(21,25)   2.90
f_0_3(3,4)_(5,8) 48.00
f_0_3(4,3)_(5,25)48.00
f_0_3(3,4)_(21,25)   48.00
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-10-15 Thread alex23

On 15/10/2014 12:23 PM, Juan Christian wrote:

Using PyCharm is easy:

File  Settings  (IDE Settings) Editor  Smart Keys  Reformat on paste
  choose Reformat Block



This isn't as straight forward as you imply. Say I have misindented code 
like this:


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

If I select this block in PyCharm and reformat it, I get:

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

Which is still invalid. Even if it did work more fully, though, how 
would it determine the correct placement of the last line of code?

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


Re: Jython or Pyton issue-- Kindly Help me....

2014-10-15 Thread Peter Otten
Venugopal Reddy wrote:

 Actuvally am having below XML File:
 
 ?xml version=1.0 encoding=UTF-8?
 soapenv:Envelope
 xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; soapenv:Body
 c:RetriveByVehicleLineModelYearResponse
 xmlns:a=urn:ford/VehicleOrder/LegacyFeatureMapping/v2.0
 xmlns:b=urn:ford/VehicleOrder/SingleOrderEdit/v1.0
 xmlns:c=urn:ford/interface/VehicleOrder/LegacyFeatureMapping/v2
 c:PortInstalledOptionFeature a:VehicleLineId13001/a:VehicleLineId
 a:ModelYear2014/a:ModelYear a:LegacyColumn12/a:LegacyColumn
 a:LegacyValue178   /a:LegacyValue
 a:SalesCodeW78/a:SalesCode
 a:MappingId41859/a:MappingId
 a:MappingSeq0/a:MappingSeq
 a:MappingDirectionB/a:MappingDirection
 a:TargetFeature
 a:TargetCatgegory
 a:Id181/a:Id
 a:NameLIGHT TRUCK WHEELBASES/a:Name
 a:TypeP/a:Type
 a:FamilyCodeAA5/a:FamilyCode
 /a:TargetCatgegory
 a:OrderFeatureId15615/a:OrderFeatureId
 a:WersCodeAA5K8/a:WersCode
 a:OrderFeatureName178 /4521MM WHEELBASE /a:OrderFeatureName
 a:PIOfalse/a:PIO
 a:SummaryFeaturefalse/a:SummaryFeature
 /a:TargetFeature
 a:TargetFeature
 a:TargetCatgegory
 a:Id181/a:Id
 a:NameLIGHT TRUCK WHEELBASES/a:Name
 a:TypeP/a:Type
 a:FamilyCodeAA5/a:FamilyCode
 /a:TargetCatgegory
 a:OrderFeatureId15615/a:OrderFeatureId
 a:WersCodeAA5K8_second time/a:WersCode
 a:OrderFeatureName178 /4521MM WHEELBASE /a:OrderFeatureName
 a:PIOfalse/a:PIO
 a:SummaryFeaturefalse/a:SummaryFeature
 /a:TargetFeature
 /c:PortInstalledOptionFeature
 c:PortInstalledOptionFeature
 a:VehicleLineId13001/a:VehicleLineId
 a:ModelYear2014/a:ModelYear
 a:LegacyColumn12/a:LegacyColumn
 a:LegacyValue190   /a:LegacyValue
 a:SalesCodeW90/a:SalesCode
 a:MappingId41860/a:MappingId
 a:MappingSeq0/a:MappingSeq
 a:MappingDirectionB/a:MappingDirection
 a:TargetFeature
 a:TargetCatgegory
 a:Id181/a:Id
 a:NameLIGHT TRUCK WHEELBASES/a:Name
 a:TypeP/a:Type
 a:FamilyCodeAA5/a:FamilyCode
 /a:TargetCatgegory
 a:OrderFeatureId15616/a:OrderFeatureId
 a:WersCodeAA5MA/a:WersCode
 a:OrderFeatureName190 /4826MM WHEELBASE /a:OrderFeatureName
 a:PIOfalse/a:PIO
 a:SummaryFeaturefalse/a:SummaryFeature
 /a:TargetFeature
 /c:PortInstalledOptionFeature
 /c:RetriveByVehicleLineModelYearResponse
 /soapenv:Body
 /soapenv:Envelope
 
 
 My expected Output is:
 
 
 WersCode
 AA5K8
 AA5MA
 
 == For this I have used below Code:
 
 mport glob
 import xml.etree.ElementTree as ET
 
 Fatfile = open('#Var_SOE_VLIS_Response_Output\\Sales_to_Wers_Code2.txt',
 'a') try:
tree = ET.parse('#Var_ENG_Response_Files\\SoapResponse1.xml')
Fatfile.write('')
WersCodeList =

tree.findall('./{urn:ford/VehicleOrder/LegacyFeatureMapping/v2.0}PortInstalledOptionFeature')
Fatfile.write('\n')
   # x = len(WersCodeList)
   # Fatfile.write(x)
Fatfile.write('\n333')
for WersCode in WersCodeList :
  Fatfile.write('\n444')
  WersCode =
  
WersCode.find('.//{urn:ford/VehicleOrder/LegacyFeatureMapping/v2.0}WersCode')
  Fatfile.write('\n') Fatfile.write(WersCode.text)
 except :
 Fatfile.write(' \nsorry')
 Fatfile.write(' \nSuccess')
 
 
 
 But I could not able to get the WersCode List using Findall.

- The namespace is not correct
- ./ finds only direct children

Try something like

for feature in tree.findall(

.//{urn:ford/interface/VehicleOrder/LegacyFeatureMapping/v2}PortInstalledOptionFeature):
code = feature.find(
.//{urn:ford/VehicleOrder/LegacyFeatureMapping/v2.0}WersCode)
print(code.text)


 Please please please help on this .. am struggling sice one week sir...

... and it's all your fault because you offered a task to do for you instead 
of some code we could help you fix.

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


Re: Code Review for Paper, Rock, Scissors

2014-10-15 Thread Larry Hudson

On 10/14/2014 01:04 AM, Revenant wrote:

Hi all!

I'm new to Python and programming in general, and am trying to learn as much as 
I can about it.

Anyway, for a basic first program I made a simple game of Paper, Rock, 
Scissors. For this program, I incorporated a main menu that presented three 
different options, allowed the user to play a game of Paper, Rock, Scissors, 
allowed them to play the game again, and most importantly checked the user's 
input to make sure the program doesn't fail due to errors.

One thing I want to try to add is a Press any key to continue function that 
occurs at the end of the program when the user decides to quit. I looked at some options 
online, but haven't quite figured it out yet.

As previously stated, I am new to Python and would also like to see if any of 
you programming gurus have some suggestions about how I can simplify code, and 
also if there are any other good starter programs to work on to improve my 
skills.

Thanks for reading! Code is below:


[snip]

You've already received a lot of good advice, which I'm not going to repeat here.  Rather, I'm 
going to show you the version that I wrote some time ago.  Whether this version is 
good/bad/indifferent is up to someone else to say, but I'm showing it here just as an example of 
a different approach that you might find interesting to study.  Although, being new to Python, 
some of the things here will probably be unfamiliar to you, particularly the new-style string 
formatting which I use a lot.


The key to this approach is to recognize that there are only nine possible combinations.  I 
handle these in the get_result() function by stitching together pieces of strings in a 
dictionary.  This function is interesting because, although it has a total of 34 lines, 17 are 
comments or blanks, 16 are data definitions, and only 1 line is actual code.


The get_rps() function is used to get the player's rock/paper/scissor choice.  It also allows 
'quit' as a fourth choice.  This makes your proposed Press any key... unnecessary, because 
this version will continue automatically until you specifically tell it to stop.  Also it 
accepts an empty input as the same as a 'quit' choice.  Whether this is good or bad is 
debatable, but it can easily be written either way.  It returns the choice as a single 
lower-case character, 'r', 'p', 's' or 'q'.


This version also makes heavy use of the constants WIN/LOSE/DRAW, which are defined as globals 
at the top of the program.  They help the clarity of the source.  Normal convention is to make 
the names of constants all upper-case.  This is a convention only, not a requirement.  The 
scores are tracked in a three-element list, which use the WIN/LOSE/DRAW constants as the 
indexes.  The instruction display in my version is very short, but it could easily be replaced 
with a longer version like yours.


FWIW, here is my code...
Note the first line is Linux-specific -- Windows will ignore it, or you can 
remove it.

#  Code starts here  
#!/usr/bin/env python3

#   rps.py -- Rock, Paper, Scissors game

from random import choice

#   Global constants
WIN  = 0
LOSE = 1
DRAW = 2

def get_result(h, c):
Determine who wins this round

Parameters:
h:  Human's selection (r, p or s)
c:  Computer's selection (r, p or s)

Returns a tuple of the WIN/LOSE/DRAW value
and the string describing the results


#   Strings used in results
pr = 'Paper covers Rock.  {}'
rs = 'Rock smashes Scissors.  {}'
sp = 'Scissors cuts Paper.  {}'
ti = 'We both have {}.  {}'

#   Win/lose/draw strings
wins = ('You win', 'I win', It's a draw)

#   Dictionary defining the results
res = {
'rr' : (DRAW, ti.format('rocks', wins[DRAW])),
'rp' : (LOSE, pr.format(wins[LOSE])),
'rs' : (WIN,  rs.format(wins[WIN])),
'pr' : (WIN,  pr.format(wins[WIN])),
'pp' : (DRAW, ti.format('paper', wins[DRAW])),
'ps' : (LOSE, sp.format(wins[LOSE])),
'sr' : (LOSE, rs.format(wins[LOSE])),
'sp' : (WIN,  sp.format(wins[WIN])),
'ss' : (DRAW, ti.format('scissors', wins[DRAW]))
}

#   Return the result tuple
return res[h + c]

def get_rps():
Get Rock/Paper/Scissor choice.
while True:
select = input('\nDo you choose Rock, Paper or Scissors ').lower()
#   Check for empty input or quit command
if not select or select in ['q', 'quit']:
return 'q'  # return quit code
#   Check for valid input
if select in ['r', 'rock', 'p', 'paper', 's', 'scissors']:
return select[0]# return first character
print('What did you say??  Try again please')

#=  Main Program starts here  ==
#   Keep track of results:
#   scores[0] = number of human wins
#   scores[1] = number of computer wins
#   scores[2] = number of draws
scores = [0] * 

Help with parsing a dict from Vendor's API?

2014-10-15 Thread Nick Ellson
Hello!

I have a very specific question related to the output of a Vendors API
(Palo Alto Networks pan.xapi and how I might farm data from this output.
I am new to python, doing well in the tutorials, but this is an automation
task at work and I know the rest will be much easier once i get past the
ability to read this dict.

The code reaches in to the central Palo Alto firewall manager (Panorama)
and executes a simple command to return all of the information for each of
the managed firewalls in the field. It captured this output in XML I
believe, but has the ability to return it in python dict format too, which
looked like probably the best format to use. Here is the test I tried

snip
xapi.op(cmd='show devices connected', cmd_xml=True )
MyDict=xapi.xml_python()
print (type(MyDict))
print (MyDict)
snip

and I get: (This displays only 2 firewalls of the 180, so you can see the
structure, and that python does say it is a dict)

bertha bin # ./test.py
class 'dict'
{'response': {'result': {'devices': {'entry': [{'av-version': '1391-1863',
'unsupported-version': False, 'ip-address': '1.8.2.8', 'sw-version':
'4.1.9', 'vsys': {'entry': [{'name': 'vsys1', 'shared-policy-md5sum':
'8a8dcd146e24bd750ae571059bc09210', 'shared-policy-status': None,
'display-name': 'vsys1'}]}, 'uptime': '350 days, 14:29:49',
'threat-version': '460-2394', 'operational-mode': 'normal', 'multi-vsys':
False, 'global-protect-client-package-version': '0.0.0', 'app-version':
'460-2394', 'model': 'PA-200', 'connected': True, 'name': '00160602',
'family': '200', 'url-filtering-version': '4390', 'vpn-disable-mode':
False, 'logdb-version': '4.1.2', 'serial': '00160602', 'hostname':
'bob-int-fw'}, {'av-version': '1391-1863', 'unsupported-version': False,
'ip-address': '1.9.8.8', 'sw-version': '4.1.9', 'vsys': {'entry': [{'name':
'vsys1', 'shared-policy-md5sum': '8a8dcd146e24bd750ae571059bc09210',
'shared-policy-status': None, 'display-name': 'vsys1'}]}, 'uptime': '358
days, 0:03:20', 'threat-version': '460-2394', 'operational-mode': 'normal',
'multi-vsys': False, 'global-protect-client-package-version': '0.0.0',
'app-version': '460-2394', 'model': 'PA-200', 'connected': True, 'name':
'00160609', 'family': '200', 'url-filtering-version': '4390',
'vpn-disable-mode': False, 'logdb-version': '4.1.2', 'serial':
'001606008639', 'hostname': 'bib-int-fw'}, repeats for 180
firewalls ]}}, 'status': 'success'}}


What I want is to parse through each firewall grabbing the ip-address
value so that I can dump it to a list:

ip
ip
ip

For use in another network management tool so I don't rely on outsourced
help to remember to place teh firewalls into the correct tools.

But dang if every dict tutorial seems to deal with slightly simpler looking
structures than what this puts out. I would be very appreciative with help
stepping out of the 6 line address book/grocery list example world for a
taste of something useful :-)

Maybe to a Python coder, it maybe a simple even be able to randomly
reference a firewall index number and teh value in this structure so one
can easily just pluck any A/V pair at will.. just not for me yet :-D

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


Re: Jython or Pyton issue-- Kindly Help me....

2014-10-15 Thread Venugopal Reddy
Thanks for Help Sir,

Am using  for feature in tree.findall( 

.//{urn:ford/interface/VehicleOrder/LegacyFeatureMapping/v2}PortInstalledOptionFeature):
 ) 

Please sir help me

Here  also  this findall Method is not return any list values.


On Wednesday, October 15, 2014 1:03:00 PM UTC+5:30, Peter Otten wrote:
 Venugopal Reddy wrote:
 
 
 
  Actuvally am having below XML File:
 
  
 
  ?xml version=1.0 encoding=UTF-8?
 
  soapenv:Envelope
 
  xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; soapenv:Body
 
  c:RetriveByVehicleLineModelYearResponse
 
  xmlns:a=urn:ford/VehicleOrder/LegacyFeatureMapping/v2.0
 
  xmlns:b=urn:ford/VehicleOrder/SingleOrderEdit/v1.0
 
  xmlns:c=urn:ford/interface/VehicleOrder/LegacyFeatureMapping/v2
 
  c:PortInstalledOptionFeature a:VehicleLineId13001/a:VehicleLineId
 
  a:ModelYear2014/a:ModelYear a:LegacyColumn12/a:LegacyColumn
 
  a:LegacyValue178   /a:LegacyValue
 
  a:SalesCodeW78/a:SalesCode
 
  a:MappingId41859/a:MappingId
 
  a:MappingSeq0/a:MappingSeq
 
  a:MappingDirectionB/a:MappingDirection
 
  a:TargetFeature
 
  a:TargetCatgegory
 
  a:Id181/a:Id
 
  a:NameLIGHT TRUCK WHEELBASES/a:Name
 
  a:TypeP/a:Type
 
  a:FamilyCodeAA5/a:FamilyCode
 
  /a:TargetCatgegory
 
  a:OrderFeatureId15615/a:OrderFeatureId
 
  a:WersCodeAA5K8/a:WersCode
 
  a:OrderFeatureName178 /4521MM WHEELBASE /a:OrderFeatureName
 
  a:PIOfalse/a:PIO
 
  a:SummaryFeaturefalse/a:SummaryFeature
 
  /a:TargetFeature
 
  a:TargetFeature
 
  a:TargetCatgegory
 
  a:Id181/a:Id
 
  a:NameLIGHT TRUCK WHEELBASES/a:Name
 
  a:TypeP/a:Type
 
  a:FamilyCodeAA5/a:FamilyCode
 
  /a:TargetCatgegory
 
  a:OrderFeatureId15615/a:OrderFeatureId
 
  a:WersCodeAA5K8_second time/a:WersCode
 
  a:OrderFeatureName178 /4521MM WHEELBASE /a:OrderFeatureName
 
  a:PIOfalse/a:PIO
 
  a:SummaryFeaturefalse/a:SummaryFeature
 
  /a:TargetFeature
 
  /c:PortInstalledOptionFeature
 
  c:PortInstalledOptionFeature
 
  a:VehicleLineId13001/a:VehicleLineId
 
  a:ModelYear2014/a:ModelYear
 
  a:LegacyColumn12/a:LegacyColumn
 
  a:LegacyValue190   /a:LegacyValue
 
  a:SalesCodeW90/a:SalesCode
 
  a:MappingId41860/a:MappingId
 
  a:MappingSeq0/a:MappingSeq
 
  a:MappingDirectionB/a:MappingDirection
 
  a:TargetFeature
 
  a:TargetCatgegory
 
  a:Id181/a:Id
 
  a:NameLIGHT TRUCK WHEELBASES/a:Name
 
  a:TypeP/a:Type
 
  a:FamilyCodeAA5/a:FamilyCode
 
  /a:TargetCatgegory
 
  a:OrderFeatureId15616/a:OrderFeatureId
 
  a:WersCodeAA5MA/a:WersCode
 
  a:OrderFeatureName190 /4826MM WHEELBASE /a:OrderFeatureName
 
  a:PIOfalse/a:PIO
 
  a:SummaryFeaturefalse/a:SummaryFeature
 
  /a:TargetFeature
 
  /c:PortInstalledOptionFeature
 
  /c:RetriveByVehicleLineModelYearResponse
 
  /soapenv:Body
 
  /soapenv:Envelope
 
  
 
  
 
  My expected Output is:
 
  
 
  
 
  WersCode
 
  AA5K8
 
  AA5MA
 
  
 
  == For this I have used below Code:
 
  
 
  mport glob
 
  import xml.etree.ElementTree as ET
 
  
 
  Fatfile = open('#Var_SOE_VLIS_Response_Output\\Sales_to_Wers_Code2.txt',
 
  'a') try:
 
 tree = ET.parse('#Var_ENG_Response_Files\\SoapResponse1.xml')
 
 Fatfile.write('')
 
 WersCodeList =
 
 
 
 tree.findall('./{urn:ford/VehicleOrder/LegacyFeatureMapping/v2.0}PortInstalledOptionFeature')
 
 Fatfile.write('\n')
 
# x = len(WersCodeList)
 
# Fatfile.write(x)
 
 Fatfile.write('\n333')
 
 for WersCode in WersCodeList :
 
   Fatfile.write('\n444')
 
   WersCode =
 
   
 
 WersCode.find('.//{urn:ford/VehicleOrder/LegacyFeatureMapping/v2.0}WersCode')
 
   Fatfile.write('\n') Fatfile.write(WersCode.text)
 
  except :
 
  Fatfile.write(' \nsorry')
 
  Fatfile.write(' \nSuccess')
 
  
 
  
 
  
 
  But I could not able to get the WersCode List using Findall.
 
 
 
 - The namespace is not correct
 
 - ./ finds only direct children
 
 
 
 Try something like
 
 
 
 for feature in tree.findall(
 
 
 .//{urn:ford/interface/VehicleOrder/LegacyFeatureMapping/v2}PortInstalledOptionFeature):
 
 code = feature.find(
 
 .//{urn:ford/VehicleOrder/LegacyFeatureMapping/v2.0}WersCode)
 
 print(code.text)
 
 
 
 
 
  Please please please help on this .. am struggling sice one week sir...
 
 
 
 ... and it's all your fault because you offered a task to do for you instead 
 
 of some code we could help you fix.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Jython or Pyton issue-- Kindly Help me....

2014-10-15 Thread Peter Otten
Venugopal Reddy wrote:

 Thanks for Help Sir,
 
 Am using  for feature in tree.findall(
 
 .//{urn:ford/interface/VehicleOrder/LegacyFeatureMapping/v2}PortInstalledOptionFeature):
 ) 
 
 Please sir help me
 
 Here  also  this findall Method is not return any list values.

OK, I tried it:

$ cat xml_werscode.py
from xml.etree import ElementTree as ET

data = ?xml version=1.0 encoding=UTF-8?
soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/;
soapenv:Body
c:RetriveByVehicleLineModelYearResponse 
xmlns:a=urn:ford/VehicleOrder/LegacyFeatureMapping/v2.0 
xmlns:b=urn:ford/VehicleOrder/SingleOrderEdit/v1.0 
xmlns:c=urn:ford/interface/VehicleOrder/LegacyFeatureMapping/v2
c:PortInstalledOptionFeature
a:VehicleLineId13001/a:VehicleLineId
a:ModelYear2014/a:ModelYear
a:LegacyColumn12/a:LegacyColumn
a:LegacyValue178   /a:LegacyValue
a:SalesCodeW78/a:SalesCode
a:MappingId41859/a:MappingId
a:MappingSeq0/a:MappingSeq
a:MappingDirectionB/a:MappingDirection
a:TargetFeature
a:TargetCatgegory
a:Id181/a:Id
a:NameLIGHT TRUCK WHEELBASES  
  /a:Name
a:TypeP/a:Type
a:FamilyCodeAA5/a:FamilyCode
/a:TargetCatgegory

a:OrderFeatureId15615/a:OrderFeatureId
a:WersCodeAA5K8/a:WersCode
a:OrderFeatureName178 /4521MM 
WHEELBASE /a:OrderFeatureName
a:PIOfalse/a:PIO

a:SummaryFeaturefalse/a:SummaryFeature
/a:TargetFeature
a:TargetFeature
a:TargetCatgegory
a:Id181/a:Id
a:NameLIGHT TRUCK WHEELBASES  
  /a:Name
a:TypeP/a:Type
a:FamilyCodeAA5/a:FamilyCode
/a:TargetCatgegory

a:OrderFeatureId15615/a:OrderFeatureId
a:WersCodeAA5K8_second 
time/a:WersCode
a:OrderFeatureName178 /4521MM 
WHEELBASE /a:OrderFeatureName
a:PIOfalse/a:PIO

a:SummaryFeaturefalse/a:SummaryFeature
/a:TargetFeature
/c:PortInstalledOptionFeature
c:PortInstalledOptionFeature
a:VehicleLineId13001/a:VehicleLineId
a:ModelYear2014/a:ModelYear
a:LegacyColumn12/a:LegacyColumn
a:LegacyValue190   /a:LegacyValue
a:SalesCodeW90/a:SalesCode
a:MappingId41860/a:MappingId
a:MappingSeq0/a:MappingSeq
a:MappingDirectionB/a:MappingDirection
a:TargetFeature
a:TargetCatgegory
a:Id181/a:Id
a:NameLIGHT TRUCK WHEELBASES  
  /a:Name
a:TypeP/a:Type
a:FamilyCodeAA5/a:FamilyCode
/a:TargetCatgegory

a:OrderFeatureId15616/a:OrderFeatureId
a:WersCodeAA5MA/a:WersCode
a:OrderFeatureName190 /4826MM 
WHEELBASE /a:OrderFeatureName
a:PIOfalse/a:PIO

a:SummaryFeaturefalse/a:SummaryFeature
/a:TargetFeature
/c:PortInstalledOptionFeature
/c:RetriveByVehicleLineModelYearResponse
/soapenv:Body
/soapenv:Envelope



tree = ET.fromstring(data)
for feature in tree.findall(

.//{urn:ford/interface/VehicleOrder/LegacyFeatureMapping/v2}PortInstalledOptionFeature):
code = 

Re: Help with parsing a dict from Vendor's API?

2014-10-15 Thread Peter Otten
Nick Ellson wrote:

 Hello!
 
 I have a very specific question related to the output of a Vendors API
 (Palo Alto Networks pan.xapi and how I might farm data from this output.
 I am new to python, doing well in the tutorials, but this is an automation
 task at work and I know the rest will be much easier once i get past the
 ability to read this dict.
 
 The code reaches in to the central Palo Alto firewall manager (Panorama)
 and executes a simple command to return all of the information for each of
 the managed firewalls in the field. It captured this output in XML I
 believe, but has the ability to return it in python dict format too, which
 looked like probably the best format to use. Here is the test I tried
 
 snip
 xapi.op(cmd='show devices connected', cmd_xml=True )
 MyDict=xapi.xml_python()
 print (type(MyDict))
 print (MyDict)
 snip
 
 and I get: (This displays only 2 firewalls of the 180, so you can see the
 structure, and that python does say it is a dict)
 
 bertha bin # ./test.py
 class 'dict'
 {'response': {'result': {'devices': {'entry': [{'av-version': '1391-1863',
 'unsupported-version': False, 'ip-address': '1.8.2.8', 'sw-version':
 '4.1.9', 'vsys': {'entry': [{'name': 'vsys1', 'shared-policy-md5sum':
 '8a8dcd146e24bd750ae571059bc09210', 'shared-policy-status': None,
 'display-name': 'vsys1'}]}, 'uptime': '350 days, 14:29:49',
 'threat-version': '460-2394', 'operational-mode': 'normal', 'multi-vsys':
 False, 'global-protect-client-package-version': '0.0.0', 'app-version':
 '460-2394', 'model': 'PA-200', 'connected': True, 'name': '00160602',
 'family': '200', 'url-filtering-version': '4390', 'vpn-disable-mode':
 False, 'logdb-version': '4.1.2', 'serial': '00160602', 'hostname':
 'bob-int-fw'}, {'av-version': '1391-1863', 'unsupported-version': False,
 'ip-address': '1.9.8.8', 'sw-version': '4.1.9', 'vsys': {'entry':
 [{'name': 'vsys1', 'shared-policy-md5sum':
 '8a8dcd146e24bd750ae571059bc09210', 'shared-policy-status': None,
 'display-name': 'vsys1'}]}, 'uptime': '358 days, 0:03:20',
 'threat-version': '460-2394', 'operational-mode': 'normal', 'multi-vsys':
 False, 'global-protect-client-package-version': '0.0.0', 'app-version':
 '460-2394', 'model': 'PA-200', 'connected': True, 'name': '00160609',
 'family': '200', 'url-filtering-version': '4390', 'vpn-disable-mode':
 False, 'logdb-version': '4.1.2', 'serial': '001606008639', 'hostname':
 'bib-int-fw'}, repeats for 180 firewalls ]}}, 'status':
 'success'}}
 
 
 What I want is to parse through each firewall grabbing the ip-address
 value so that I can dump it to a list:
 
 ip
 ip
 ip
 
 For use in another network management tool so I don't rely on outsourced
 help to remember to place teh firewalls into the correct tools.
 
 But dang if every dict tutorial seems to deal with slightly simpler
 looking structures than what this puts out. I would be very appreciative
 with help stepping out of the 6 line address book/grocery list example
 world for a taste of something useful :-)
 
 Maybe to a Python coder, it maybe a simple even be able to randomly
 reference a firewall index number and teh value in this structure so one
 can easily just pluck any A/V pair at will.. just not for me yet :-D

Look at your dict (I use the name 'd' instead of 'MyDict'):

d = {response: {result: ...}

So

d[response]

will give you 

{result: {devices: ...}

A good tool to explore a data structure like this is the interactive 
interpreter. If you invoke the script with

python -i test.py

you have all its global variables available, i. e.

 MyDict
{ ... } # you should see the dictionary contents


On we go:

d[response][result]

will give

{devices: {entry: ...}

Next step:

d[response][result][devices]

--

{entry: [...]

That's a list for change, so you loop over it:

entries = d[response][result][devices][entry]
for entry in entries:
print(entry) # -- {..., 'ip-address': '1.8.2.8', ... }

So the final code is:

for entry in d[response][result][devices][entry]:
print(entry[ip-address])


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


[ANN] pdb-clone 1.9 - a fast clone of pdb with the remote debugging and attach features

2014-10-15 Thread Xavier de Gaye

pdb-clone 1.9 has been released at Pypi: https://pypi.python.org/pypi/pdb-clone

Features:
  * Improve significantly pdb performance. With breakpoints, pdb-clone runs 
just above the speed of the interpreter while pdb runs at 10 to 100 times the 
speed of the interpreter.

  * Extend pdb with remote debugging. A remote debugging session may be started when the program stops at a `pdb.set_trace_remote()` hard-coded breakpoint, or at any time and multiple times by 
attaching to the process main thread. This feature is implemented in the py3 and py2.7 versions of pdb-clone.


  * Fix pdb long standing bugs entered in the python issue tracker.

  * Add a bdb comprehensive test suite (more than 70 tests) and run both the 
Python pdb and pdb-clone bdb test suites.

  * Three versions of pdb-clone are supported:
* The py3 version of pdb-clone runs on python3 from python 3.2 onward.
* The py2.7 vesion runs on python 2.7.
* The py2.4 version runs on all python versions from 2.4 to 2.7 included.

The pdb command line interface remains unchanged except for the new `detach` and `thread` pdb commands. All the versions of pdb-clone implement the most recent python3 features of pdb, as defined in 
Python documentation.

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


Re: Help with parsing a dict from Vendor's API?

2014-10-15 Thread Nick Ellson
Thank you Peter! 

That makes sense, and I did find pprint that dumped it out aligned so I could 
actually see the nested layers you are referring to. 

That got me my IP's. :-) I'll play with this now and see if I can harvest 
something targeted.. Like list all device host names running code 4.1.9, or 
display the serial number of the device with hostname 'foo'

That should get me on my way to productive fun :-)

Nick

Nick Ellson - from iPhone (forgive typos)
CCIE #20018
Network Hobbyist
Educating Layer 8, one user at a time.

 On Oct 15, 2014, at 2:22 AM, Peter Otten __pete...@web.de wrote:
 
 Nick Ellson wrote:
 
 Hello!
 
 I have a very specific question related to the output of a Vendors API
 (Palo Alto Networks pan.xapi and how I might farm data from this output.
 I am new to python, doing well in the tutorials, but this is an automation
 task at work and I know the rest will be much easier once i get past the
 ability to read this dict.
 
 The code reaches in to the central Palo Alto firewall manager (Panorama)
 and executes a simple command to return all of the information for each of
 the managed firewalls in the field. It captured this output in XML I
 believe, but has the ability to return it in python dict format too, which
 looked like probably the best format to use. Here is the test I tried
 
 snip
 xapi.op(cmd='show devices connected', cmd_xml=True )
 MyDict=xapi.xml_python()
 print (type(MyDict))
 print (MyDict)
 snip
 
 and I get: (This displays only 2 firewalls of the 180, so you can see the
 structure, and that python does say it is a dict)
 
 bertha bin # ./test.py
 class 'dict'
 {'response': {'result': {'devices': {'entry': [{'av-version': '1391-1863',
 'unsupported-version': False, 'ip-address': '1.8.2.8', 'sw-version':
 '4.1.9', 'vsys': {'entry': [{'name': 'vsys1', 'shared-policy-md5sum':
 '8a8dcd146e24bd750ae571059bc09210', 'shared-policy-status': None,
 'display-name': 'vsys1'}]}, 'uptime': '350 days, 14:29:49',
 'threat-version': '460-2394', 'operational-mode': 'normal', 'multi-vsys':
 False, 'global-protect-client-package-version': '0.0.0', 'app-version':
 '460-2394', 'model': 'PA-200', 'connected': True, 'name': '00160602',
 'family': '200', 'url-filtering-version': '4390', 'vpn-disable-mode':
 False, 'logdb-version': '4.1.2', 'serial': '00160602', 'hostname':
 'bob-int-fw'}, {'av-version': '1391-1863', 'unsupported-version': False,
 'ip-address': '1.9.8.8', 'sw-version': '4.1.9', 'vsys': {'entry':
 [{'name': 'vsys1', 'shared-policy-md5sum':
 '8a8dcd146e24bd750ae571059bc09210', 'shared-policy-status': None,
 'display-name': 'vsys1'}]}, 'uptime': '358 days, 0:03:20',
 'threat-version': '460-2394', 'operational-mode': 'normal', 'multi-vsys':
 False, 'global-protect-client-package-version': '0.0.0', 'app-version':
 '460-2394', 'model': 'PA-200', 'connected': True, 'name': '00160609',
 'family': '200', 'url-filtering-version': '4390', 'vpn-disable-mode':
 False, 'logdb-version': '4.1.2', 'serial': '001606008639', 'hostname':
 'bib-int-fw'}, repeats for 180 firewalls ]}}, 'status':
 'success'}}
 
 
 What I want is to parse through each firewall grabbing the ip-address
 value so that I can dump it to a list:
 
 ip
 ip
 ip
 
 For use in another network management tool so I don't rely on outsourced
 help to remember to place teh firewalls into the correct tools.
 
 But dang if every dict tutorial seems to deal with slightly simpler
 looking structures than what this puts out. I would be very appreciative
 with help stepping out of the 6 line address book/grocery list example
 world for a taste of something useful :-)
 
 Maybe to a Python coder, it maybe a simple even be able to randomly
 reference a firewall index number and teh value in this structure so one
 can easily just pluck any A/V pair at will.. just not for me yet :-D
 
 Look at your dict (I use the name 'd' instead of 'MyDict'):
 
 d = {response: {result: ...}
 
 So
 
 d[response]
 
 will give you 
 
 {result: {devices: ...}
 
 A good tool to explore a data structure like this is the interactive 
 interpreter. If you invoke the script with
 
 python -i test.py
 
 you have all its global variables available, i. e.
 
 MyDict
 { ... } # you should see the dictionary contents
 
 
 On we go:
 
 d[response][result]
 
 will give
 
 {devices: {entry: ...}
 
 Next step:
 
 d[response][result][devices]
 
 --
 
 {entry: [...]
 
 That's a list for change, so you loop over it:
 
 entries = d[response][result][devices][entry]
 for entry in entries:
print(entry) # -- {..., 'ip-address': '1.8.2.8', ... }
 
 So the final code is:
 
 for entry in d[response][result][devices][entry]:
print(entry[ip-address])
 
 
 -- 
 https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-10-15 Thread Chris “Kwpolska” Warrick
On Wed, Oct 15, 2014 at 9:27 AM, alex23 wuwe...@gmail.com wrote:
 On 15/10/2014 12:23 PM, Juan Christian wrote:

 Using PyCharm is easy:

 File  Settings  (IDE Settings) Editor  Smart Keys  Reformat on paste
   choose Reformat Block



 This isn't as straight forward as you imply. Say I have misindented code
 like this:

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

 If I select this block in PyCharm and reformat it, I get:

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

 Which is still invalid. Even if it did work more fully, though, how would it
 determine the correct placement of the last line of code?
 --
 https://mail.python.org/mailman/listinfo/python-list

It should parse this as

else:
print 'false'
print 'done'

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

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

print 'done'

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

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


Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Anurag Patibandla
Thanks Rustom for the advice.
I am new to Python and getting struck at some basic things. How do I assign the 
values that I am printing to 3 variables say dict1, dict2, dict3?
When I try to assign them before the print statement like this:
d1, d2, d3 =[(queues[j], json.get(queues[j])) for j in range(len(queues))]

I get an error saying 'need more than one value to unpack'
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: CLI framework using python

2014-10-15 Thread vijnaana bhairava
Hi Naoki,

I am new to python programming. Getting used to writing basic scripts to 
understand python.

To understand 'Click' i may need some more guidance.

For e.g if i were to do 'ifconfig -a' from Click, how would the program look 
like. That will help me get started.

What i am looking for is a class based approach.

For e.g all interface related commands could come under class Interface and 
'ifconfig' would probably be a method.

I would like to see one working program to get a feel for 'Click'

Thank You!
vij

On Tuesday, October 14, 2014 7:46:44 PM UTC+5:30, INADA Naoki wrote:
 Click_ is another CLI framework.
 
 It support multi-level nested command like git and it has some nice utilities.
 
 I love it's design.
 
 
 
 
 
 
 
 .. _click: http://click.pocoo.org/3/
 
 
 
 --
 Sent from Mailbox
 
 
 
 
 
 On Tue, Oct 14, 2014 at 10:35 PM, vijnaana bhairava vijn...@gmail.com wrote:
 
 Hi Folks,
 
 
 The requirement is to develop a CLI framework in python for a linux router.
 
 The suggestions i got is to use PyCli/Cliff. Not sure which would be the 
 right choice!  Also, a few APIs are mentioned here: 
 
 
 https://pythonhosted.org/pyCLI/#module-cli.app
 
 
 Since i couldn't find any actual implementation which uses pyCli,
 
 i can't figure out how to make use of pyCLI.
 
 
 Another question i have is whether it uses argparse?
 
 If so, what value add does PYCLI do?
 
 
 Regards,
 
 vij
 
 
 On Thursday, October 9, 2014 5:50:51 PM UTC+5:30, vijnaana bhairava wrote:
 
  Hi,
 
  
 
  
 
  
 
  I need to develop a python CLI framework.
 
  
 
  
 
  
 
  For example if i need to set an ip address in linux:
 
  
 
  
 
  
 
  ifconfig eth0 172.16.25.125
 
  
 
  
 
  
 
  I should be able to use python to do the above.
 
  
 
  
 
  
 
  1. The user will execute a python script to which i will pass the params 
  eth0 and ip address (something like ifconf.py  eth0 172.16.25.125)
 
  
 
  
 
  
 
  2. Within the script i grab the params and do something to the effect of 
  user executing 'ifconfig eth0 172.16.25.125' from the shell.
 
  
 
  
 
  
 
  3. There are other such commands for which i will be using python scripts. 
  I came across pyCLI, but it doesn't have much documentation, so couldn't 
  figure out how to move forward.
 
  
 
  
 
  
 
  4. The CLI framework needs to reuse code so i didn't want to use pure 
  python and develop a framework from scratch. Rather use something like 
  pyCLI/CLIFF.
 
  
 
  
 
  
 
  The problem is lack of documentation with examples on how to use the above.
 
  
 
  
 
  
 
  Any guidance would be greatly appreciated.
 
  
 
  
 
  
 
  Regards  Thanks,
 
  
 
  Vij
 
 -- 
 
 https://mail.python.org/mailman/listinfo/python-list

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


Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Rustom Mody
On Wednesday, October 15, 2014 9:22:48 PM UTC+5:30, Anurag Patibandla wrote:
 Thanks Rustom for the advice.
 I am new to Python and getting struck at some basic things. How do I assign 
 the values that I am printing to 3 variables say dict1, dict2, dict3?
 When I try to assign them before the print statement like this:
 d1, d2, d3 =[(queues[j], json.get(queues[j])) for j in range(len(queues))]

 I get an error saying 'need more than one value to unpack'

Probably means your comprehension

[(queues[j], json.get(queues[j])) for j in range(len(queues))]

is having less than 3 values

 lst = [1,2,3]
 x,y,z = lst
 (x,y,z) # note no need to print
(1, 2, 3)
 lst=[1]
 x,y,z=lst
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: need more than 1 value to unpack
 lst=[1,2,3,4]
 x,y,z=lst
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: too many values to unpack


I suggest youdont directly start with multiple assignment
Instead do it in two steps

dicts = [(queues[j], json.get(queues[j])) for j in range(len(queues))]

d0 = dicts[0]
d1 = dicts[1]
d2 = dicts[2]

When that works go to the more compact form

Also please get rid of the range(len(queues))
Its unpythonic!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Anurag Patibandla
First the values printed by
'[(queues[j], json.get(queues[j])) for j in range(len(queues))] '
is a list, so I tried to convert it into a dict using dict().
And then I tried doing dict[0] but there is an error which says:
'type' object has no attribute '__getitem__'

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


Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Rustom Mody
On Wednesday, October 15, 2014 9:58:49 PM UTC+5:30, Anurag Patibandla wrote:
 First the values printed by
 '[(queues[j], json.get(queues[j])) for j in range(len(queues))] '
 is a list, so I tried to convert it into a dict using dict().
 And then I tried doing dict[0] but there is an error which says:
 'type' object has no attribute '__getitem__'

print each step in the process until the error step

Also assuming

[(queues[j], json.get(queues[j])) for j in range(len(queues))]

is the same as

[(q, json.get(q) for q in queues]

do

a = [(q, json.get(q) for q in queues]
print a
b = dict(a)
print b
c = b[0]
print c

or whatever it is you are doing

and PASTE (not NARRATE) the results
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Anurag Patibandla
keys = json.keys()
order = list(keys)
q1 = int(round(len(keys)*0.2))
q2 = int(round(len(keys)*0.3))
q3 = int(round(len(keys)*0.5))
b = [q1,q2,q3]
n=0
for i in b:
queues = order[n:n+i]

n = n+i
#print queues
#print [(queues[j], json.get(queues[j])) for j in range(len(queues))] 
lists = [(queues[j], json.get(queues[j])) for j in range(len(queues))] 
#print lists
dicts = dict(lists)
print dicts
print dict[0]

Print dicts works as expected giving me the combine dictionary values. But when 
I say dict[0]. I see the error:
TypeError: 'type' object has no attribute '__getitem__'
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Rustom Mody
On Wednesday, October 15, 2014 10:13:18 PM UTC+5:30, Rustom Mody wrote:
 On Wednesday, October 15, 2014 9:58:49 PM UTC+5:30, Anurag Patibandla wrote:
  First the values printed by
  '[(queues[j], json.get(queues[j])) for j in range(len(queues))] '
  is a list, so I tried to convert it into a dict using dict().
  And then I tried doing dict[0] but there is an error which says:
  'type' object has no attribute '__getitem__'

Also there are dictionary comprehensions recently added to python:
http://legacy.python.org/dev/peps/pep-0274/

Can generally be used if you are doing
dict(a list comprehension)

To start with though, I suggest you stay with the longer older form
until you understand how it works
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Anurag Patibandla
keys = json.keys()
order = list(keys)
q1 = int(round(len(keys)*0.2))
q2 = int(round(len(keys)*0.3))
q3 = int(round(len(keys)*0.5))
b = [q1,q2,q3]
n=0
for i in b:
queues = order[n:n+i]

n = n+i
lists = [(queues[j], json.get(queues[j])) for j in range(len(queues))] 

dicts = dict(lists)
print dicts
print dict[0]

print dicts works as expected. It gives me the entire dictionary. But when I do 
dicts[0], there is the following error:
'type' object has no attribute '__getitem__'
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-10-15 Thread Terry Reedy

On 10/15/2014 10:32 AM, Chris “Kwpolska” Warrick wrote:

On Wed, Oct 15, 2014 at 9:27 AM, alex23 wuwe...@gmail.com wrote:

On 15/10/2014 12:23 PM, Juan Christian wrote:


Using PyCharm is easy:

File  Settings  (IDE Settings) Editor  Smart Keys  Reformat on paste
   choose Reformat Block




This isn't as straight forward as you imply. Say I have misindented code
like this:

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

If I select this block in PyCharm and reformat it, I get:

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

Which is still invalid. Even if it did work more fully, though, how would it
determine the correct placement of the last line of code?
--
https://mail.python.org/mailman/listinfo/python-list


It should parse this as

else:
 print 'false'
 print 'done'

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


There is no such rule in Python so it hardly dependable for auto indenting.



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

print 'done'

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




--
Terry Jan Reedy


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


Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Rustom Mody
On Wednesday, October 15, 2014 10:30:49 PM UTC+5:30, Anurag Patibandla wrote:
 keys = json.keys()
 order = list(keys)
 q1 = int(round(len(keys)*0.2))
 q2 = int(round(len(keys)*0.3))
 q3 = int(round(len(keys)*0.5))
 b = [q1,q2,q3]
 n=0
 for i in b:
 queues = order[n:n+i]

 n = n+i
 lists = [(queues[j], json.get(queues[j])) for j in range(len(queues))] 

 dicts = dict(lists)
 print dicts
 print dict[0]


 print dicts works as expected. It gives me the entire dictionary. But when I 
 do dicts[0], there is the following error:
 'type' object has no attribute '__getitem__'

Do you want dict[0] ??
I think you want dicts[0]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Anurag Patibandla
On Wednesday, October 15, 2014 1:10:41 PM UTC-4, Rustom Mody wrote:
 On Wednesday, October 15, 2014 10:30:49 PM UTC+5:30, Anurag Patibandla wrote:
 
  keys = json.keys()
 
  order = list(keys)
 
  q1 = int(round(len(keys)*0.2))
 
  q2 = int(round(len(keys)*0.3))
 
  q3 = int(round(len(keys)*0.5))
 
  b = [q1,q2,q3]
 
  n=0
 
  for i in b:
 
  queues = order[n:n+i]
 
 
 
  n = n+i
 
  lists = [(queues[j], json.get(queues[j])) for j in range(len(queues))] 
 
 
 
  dicts = dict(lists)
 
  print dicts
 
  print dict[0]
 
 
 
 
 
  print dicts works as expected. It gives me the entire dictionary. But when 
  I do dicts[0], there is the following error:
 
  'type' object has no attribute '__getitem__'
 
 
 
 Do you want dict[0] ??
 
 I think you want dicts[0]

Sorry about that. 
dicts[0] gives me a KeyError: 0
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Anurag Patibandla
Here is my sample dict if that helps:

json = {1: {Status: Submitted, Startdate: [01/01/2011], Enddate: 
[02/02/2012], Job_ID: 1, m_Quantile: 80, m_Controller: Python, 
m_Method: Distributed, Allocation_3: [50], Allocation_2: [30], 
Allocation_1: [20], Note: , m_Iterations: 1000, submit: 
[Submit], VaR: , Asset_2: [YHOO], Asset_3: [CAT], Asset_1: 
[AAPL]}, 3: {Status: Submitted, Startdate: [01/01/2011], Enddate: 
[02/02/2012], Job_ID: 3, m_Quantile: 90, m_Controller: Python, 
m_Method: Distributed, Allocation_3: [50], Allocation_2: [30], 
Allocation_1: [20], Note: , m_Iterations: 1000, submit: 
[Submit], VaR: , Asset_2: [YHOO], Asset_3: [CAT], Asset_1: 
[AAPL]}, 2: {Status: Submitted, Startdate: [01/01/2011], Enddate: 
[02/02/2012], Job_ID: 2, m_Quantile: 80, m_Controller: Python, 
m_Method: GARCH, Allocation_3: [50], Allocation_2: [30], 
Allocation_1: [20], No
 te: , m_Iterations: 1000, submit: [Submit], VaR: , Asset_2: 
[YHOO], Asset_3: [CAT], Asset_1: [AAPL]}, 4: {Status: 
Submitted, Startdate: [01/01/2011], Enddate: [02/02/2012], Job_ID: 
4, m_Quantile: 90, m_Controller: Python, m_Method: GARCH, 
Allocation_3: [50], Allocation_2: [30], Allocation_1: [20], Note: 
, m_Iterations: 1000, submit: [Submit], VaR: , Asset_2: 
[YHOO], Asset_3: [CAT], Asset_1: [AAPL]}}
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Rustom Mody
On Wednesday, October 15, 2014 10:51:11 PM UTC+5:30, Anurag Patibandla wrote:
 Here is my sample dict if that helps:
 
 
 
 json = {1: {Status: Submitted, Startdate: [01/01/2011], Enddate: 
 [02/02/2012], Job_ID: 1, m_Quantile: 80, m_Controller: Python, 
 m_Method: Distributed, Allocation_3: [50], Allocation_2: [30], 
 Allocation_1: [20], Note: , m_Iterations: 1000, submit: 
 [Submit], VaR: , Asset_2: [YHOO], Asset_3: [CAT], Asset_1: 
 [AAPL]}, 3: {Status: Submitted, Startdate: [01/01/2011], 
 Enddate: [02/02/2012], Job_ID: 3, m_Quantile: 90, m_Controller: 
 Python, m_Method: Distributed, Allocation_3: [50], Allocation_2: 
 [30], Allocation_1: [20], Note: , m_Iterations: 1000, submit: 
 [Submit], VaR: , Asset_2: [YHOO], Asset_3: [CAT], Asset_1: 
 [AAPL]}, 2: {Status: Submitted, Startdate: [01/01/2011], 
 Enddate: [02/02/2012], Job_ID: 2, m_Quantile: 80, m_Controller: 
 Python, m_Method: GARCH, Allocation_3: [50], Allocation_2: 
 [30], Allocation_1: [20], 
 Note: , m_Iterations: 1000, submit: [Submit], VaR: , Asset_2: 
[YHOO], Asset_3: [CAT], Asset_1: [AAPL]}, 4: {Status: 
Submitted, Startdate: [01/01/2011], Enddate: [02/02/2012], Job_ID: 
4, m_Quantile: 90, m_Controller: Python, m_Method: GARCH, 
Allocation_3: [50], Allocation_2: [30], Allocation_1: [20], Note: 
, m_Iterations: 1000, submit: [Submit], VaR: , Asset_2: 
[YHOO], Asset_3: [CAT], Asset_1: [AAPL]}}

Right
So your dict (which is dicts !) we have
 json.keys()
['1', '3', '2', '4']

And so

 json[0]
Traceback (most recent call last):
  File stdin, line 1, in module
KeyError: 0

 json['0']
Traceback (most recent call last):
  File stdin, line 1, in module
KeyError: '0'

 json['1']
{'Status': 'Submitted', 'Startdate': ['01/01/2011'], 'Enddate': ['02/02/2012'], 
'Job_ID': 1, 'm_Quantile': '80', 'Allocation_3': ['50'], 'm_Method': 
'Distributed', 'm_Controller': 'Python', 'Allocation_2': ['30'], 
'Allocation_1': ['20'], 'Asset_2': ['YHOO'], 'Note': '', 'VaR': '', 'submit': 
['Submit'], 'm_Iterations': '1000', 'Asset_3': ['CAT'], 'Asset_1': ['AAPL']}

IOW 0 is not a key 
Neither is '0' (the string containing the char 0)
But the string '1' is a valid key
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Dave Angel
Anurag Patibandla anuragpatiband...@gmail.com Wrote in message:
 Thanks for the response.
 Here is the code that I have tried.
 
 from operator import itemgetter
 keys = json.keys()
 order = list(keys)
 q1 = int(round(len(keys)*0.2))
 q2 = int(round(len(keys)*0.3))
 q3 = int(round(len(keys)*0.5))
 b = [q1,q2,q3]
 n=0

threedicts = []

 for i in b:
 queues = order[n:n+i]
 
 n = n+i
 print queues
 
 for j in range(len(queues)):
 q = (queues[j], json.get(queues[j]))
 print q
 

   onedict = {}
   for q in queues:
   onedict[q] = json[q]
   threedicts.append (onedict)
   dict1, dictw, dict3 = threedicts 
   
 By this I am able to get the 3 smaller dicts I want, but can you help me 
 assign them to 3 variables?
 The dicts need not be ordered but it would be better if they are ordered.
 

dicts are not ordered. If you want the items in a particular
 order, you have to do that after extraction from the dict. There
 is a related type called collections.OrderedDict, which
 'remembers' the order things were added.

-- 
DaveA

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


Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Dave Angel
Anurag Patibandla anuragpatiband...@gmail.com Wrote in message:
 On Wednesday, October 15, 2014 1:10:41 PM UTC-4, Rustom Mody wrote:
 On Wednesday, October 15, 2014 10:30:49 PM UTC+5:30, Anurag Patibandla wrote:
 
  keys = json.keys()
 
  order = list(keys)
 
  q1 = int(round(len(keys)*0.2))
 
  q2 = int(round(len(keys)*0.3))
 
  q3 = int(round(len(keys)*0.5))
 
  b = [q1,q2,q3]
 
  n=0
 
  for i in b:
 
  queues = order[n:n+i]
 
 
 
  n = n+i
 
  lists = [(queues[j], json.get(queues[j])) for j in range(len(queues))] 
 
 
 
  dicts = dict(lists)
 
  print dicts
 
  print dict[0]
 
 
 
 
 
  print dicts works as expected. It gives me the entire dictionary. But when 
  I do dicts[0], there is the following error:
 
  'type' object has no attribute '__getitem__'
 
 
 
 Do you want dict[0] ??
 
 I think you want dicts[0]
 
 Sorry about that. 
 dicts[0] gives me a KeyError: 0
 

If the keys are all strings, why would you expect to find any
 items with an int key?

-- 
DaveA

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


Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Dave Angel
Anurag Patibandla anuragpatiband...@gmail.com Wrote in message:

 dicts = dict(lists)
 print dicts
 print dict[0]
 
 Print dicts works as expected giving me the combine dictionary values. But 
 when I say dict[0]. I see the error:
 TypeError: 'type' object has no attribute '__getitem__'
 

Of course. You forgot the s in the name dicts. So you were
 referring to the dict class, not your variable.
-- 
DaveA

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


Re:[ANN] pdb-clone 1.9 - a fast clone of pdb with the remote debugging and attach features

2014-10-15 Thread Dave Angel
Xavier de Gaye xdeg...@gmail.com Wrote in message:
 pdb-clone 1.9 has been released at Pypi: 
 https://pypi.python.org/pypi/pdb-clone
 
 Features:
* Improve significantly pdb performance. With breakpoints, pdb-clone runs 
 just above the speed of the interpreter while pdb runs at 10 to 100 times the 
 speed of the interpreter.

You probably mean below, and .1 to .01 times the speed.  I've
 never seen a debugger that substantially improves the code's
 performance.

 
* Extend pdb with remote debugging. A remote debugging session may be 
 started when the program stops at a `pdb.set_trace_remote()` hard-coded 
 breakpoint, or at any time and multiple times by 
 attaching to the process main thread. This feature is implemented in the py3 
 and py2.7 versions of pdb-clone.
 
* Fix pdb long standing bugs entered in the python issue tracker.
 
* Add a bdb comprehensive test suite (more than 70 tests) and run both the 
 Python pdb and pdb-clone bdb test suites.
 
* Three versions of pdb-clone are supported:
  * The py3 version of pdb-clone runs on python3 from python 3.2 onward.
  * The py2.7 vesion runs on python 2.7.
  * The py2.4 version runs on all python versions from 2.4 to 2.7 included.
 
 The pdb command line interface remains unchanged except for the new `detach` 
 and `thread` pdb commands. All the versions of pdb-clone implement the most 
 recent python3 features of pdb, as defined in 
 Python documentation.
 


-- 
DaveA

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


Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Anurag Patibandla
On Wednesday, October 15, 2014 1:35:43 PM UTC-4, Rustom Mody wrote:
 On Wednesday, October 15, 2014 10:51:11 PM UTC+5:30, Anurag Patibandla wrote:
 
  Here is my sample dict if that helps:
 
  
 
  
 
  
 
  json = {1: {Status: Submitted, Startdate: [01/01/2011], 
  Enddate: [02/02/2012], Job_ID: 1, m_Quantile: 80, m_Controller: 
  Python, m_Method: Distributed, Allocation_3: [50], 
  Allocation_2: [30], Allocation_1: [20], Note: , m_Iterations: 
  1000, submit: [Submit], VaR: , Asset_2: [YHOO], Asset_3: 
  [CAT], Asset_1: [AAPL]}, 3: {Status: Submitted, Startdate: 
  [01/01/2011], Enddate: [02/02/2012], Job_ID: 3, m_Quantile: 90, 
  m_Controller: Python, m_Method: Distributed, Allocation_3: 
  [50], Allocation_2: [30], Allocation_1: [20], Note: , 
  m_Iterations: 1000, submit: [Submit], VaR: , Asset_2: 
  [YHOO], Asset_3: [CAT], Asset_1: [AAPL]}, 2: {Status: 
  Submitted, Startdate: [01/01/2011], Enddate: [02/02/2012], 
  Job_ID: 2, m_Quantile: 80, m_Controller: Python, m_Method: 
  GARCH, Allocation_3: [50], Allocation_2: [30], Allocation_1: 
  [20],
  Note: , m_Iterations: 1000, submit: [Submit], VaR: , 
Asset_2: [YHOO], Asset_3: [CAT], Asset_1: [AAPL]}, 4: {Status: 
Submitted, Startdate: [01/01/2011], Enddate: [02/02/2012], Job_ID: 
4, m_Quantile: 90, m_Controller: Python, m_Method: GARCH, 
Allocation_3: [50], Allocation_2: [30], Allocation_1: [20], Note: 
, m_Iterations: 1000, submit: [Submit], VaR: , Asset_2: 
[YHOO], Asset_3: [CAT], Asset_1: [AAPL]}}
 
 
 
 Right
 
 So your dict (which is dicts !) we have
 
  json.keys()
 
 ['1', '3', '2', '4']
 
 
 
 And so
 
 
 
  json[0]
 
 Traceback (most recent call last):
 
   File stdin, line 1, in module
 
 KeyError: 0
 
 
 
  json['0']
 
 Traceback (most recent call last):
 
   File stdin, line 1, in module
 
 KeyError: '0'
 
 
 
  json['1']
 
 {'Status': 'Submitted', 'Startdate': ['01/01/2011'], 'Enddate': 
 ['02/02/2012'], 'Job_ID': 1, 'm_Quantile': '80', 'Allocation_3': ['50'], 
 'm_Method': 'Distributed', 'm_Controller': 'Python', 'Allocation_2': ['30'], 
 'Allocation_1': ['20'], 'Asset_2': ['YHOO'], 'Note': '', 'VaR': '', 'submit': 
 ['Submit'], 'm_Iterations': '1000', 'Asset_3': ['CAT'], 'Asset_1': ['AAPL']}
 
 
 
 IOW 0 is not a key 
 
 Neither is '0' (the string containing the char 0)
 
 But the string '1' is a valid key

Yes, but I can't just do 'json['1']', at the end of the code I need to do a 
'dicts['1']', or 'dicts['2']', to get the smaller dicts which still gives me a 
'KeyError: 1'
-- 
https://mail.python.org/mailman/listinfo/python-list


Creating a counter

2014-10-15 Thread Shiva
Hi,

I am trying to search a string through files in a directory - however while
Python script works on it and writes a log - I want to present the user with
count of number of strings found. So it should increment for each string found.

How do I implement it?

If I use a print() within a if condition statement - and execute the script
in terminal - for each find, the print() prints in new line instead of a
constantly incrementing counter.

Thanks,
Shiva

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


Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Anurag Patibandla
On Wednesday, October 15, 2014 1:41:13 PM UTC-4, Dave Angel wrote:
 Anurag Patibandla anuragpatiband...@gmail.com Wrote in message:
 
  Thanks for the response.
 
  Here is the code that I have tried.
 
  
 
  from operator import itemgetter
 
  keys = json.keys()
 
  order = list(keys)
 
  q1 = int(round(len(keys)*0.2))
 
  q2 = int(round(len(keys)*0.3))
 
  q3 = int(round(len(keys)*0.5))
 
  b = [q1,q2,q3]
 
  n=0
 
 
 
 threedicts = []
 
 
 
  for i in b:
 
  queues = order[n:n+i]
 
  
 
  n = n+i
 
  print queues
 
  
 
  for j in range(len(queues)):
 
  q = (queues[j], json.get(queues[j]))
 
  print q
 
  
 
 
 
onedict = {}
 
for q in queues:
 
onedict[q] = json[q]
 
threedicts.append (onedict)
 
dict1, dictw, dict3 = threedicts 
 

 
  By this I am able to get the 3 smaller dicts I want, but can you help me 
  assign them to 3 variables?
 
  The dicts need not be ordered but it would be better if they are ordered.
 
  
 
 
 
 dicts are not ordered. If you want the items in a particular
 
  order, you have to do that after extraction from the dict. There
 
  is a related type called collections.OrderedDict, which
 
  'remembers' the order things were added.
 
 
 
 -- 
 
 DaveA

Thanks DaveA!
This works perfectly!
-- 
https://mail.python.org/mailman/listinfo/python-list


How to debug Python IDLE?

2014-10-15 Thread ryguy7272
I'm wondering how to debug code in IDLE Python 3.4.  I found this.
http://www.cs.uky.edu/~paulp/CS115F11/notes/debug/debug.html

That looks pretty helpful, but mine is nothing like that.  All my controls are 
greyed out.  The debugger does basically...nothing.  All I get is messages like 
this.

[DEBUG ON]
 
[DEBUG OFF]
 
[DEBUG ON]
 

It doesn't debug anything at all.

Any idea what's wrong?
Thanks.

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


tkinter (Tkinter ;-) )

2014-10-15 Thread tntsugar
hi guys,

can you help me please...

i installed python 3.4.2 and the IEP editor...

now i want to program a little thingy with a window, a button and some
entry fields that are connected to a simple calculation...

the IEP shows me 3.4.2 without GUI...

strange... in the instalation i see the package being installed but when i
check in the command box i get a message that tkinter is not installed (yes
i tried both ways T and t...)...

any ideas on what i can do to start programming GUI with tkinter?

be well and greetings from the desert,

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


Re: Creating a counter

2014-10-15 Thread Ian Kelly
On Wed, Oct 15, 2014 at 12:39 PM, Shiva
shivaji...@yahoo.com.dmarc.invalid wrote:
 Hi,

 I am trying to search a string through files in a directory - however while
 Python script works on it and writes a log - I want to present the user with
 count of number of strings found. So it should increment for each string 
 found.

 How do I implement it?

 If I use a print() within a if condition statement - and execute the script
 in terminal - for each find, the print() prints in new line instead of a
 constantly incrementing counter.

Before the loop, initialize the counter to 0:

counter = 0

Inside the loop, increment the counter:

counter = counter + 1  # can be shortened to: counter += 1

Alternatively, if you have all the strings you want to count in a
list, you can just check the length of the list:

print(len(os.listdir(/some/directory)))
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to debug Python IDLE?

2014-10-15 Thread Terry Reedy

On 10/15/2014 3:09 PM, ryguy7272 wrote:

I'm wondering how to debug code in IDLE Python 3.4.  I found this.


Use 3.4.2, which has an important bugfix for debugger.


http://www.cs.uky.edu/~paulp/CS115F11/notes/debug/debug.html

That looks pretty helpful,



but mine is nothing like that.  All my controls are greyed out.


That is normal when you first turn debugger on.  You have to load a file 
in the editor and then run it (F5).  On the site above, the file is 
volume.py.  The the debugger is 'activated'.


--
Terry Jan Reedy

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


Re: tkinter (Tkinter ;-) )

2014-10-15 Thread Terry Reedy

On 10/15/2014 3:12 PM, tntsu...@googlemail.com wrote:

hi guys,

can you help me please...

i installed python 3.4.2


What system?

 and the IEP editor...

I have no idea what that is.


now i want to program a little thingy with a window, a button and some
entry fields that are connected to a simple calculation...

the IEP shows me 3.4.2 without GUI...

strange... in the instalation i see the package being installed


Which package.

 but when

i check in the command box i get a message that tkinter is not installed
(yes i tried both ways T and t...)...


tkinter needs tcl/tk.  The Windows installer installs this automtically. 
 The installer on other systems may not.


--
Terry Jan Reedy

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


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

2014-10-15 Thread Ian Kelly
On Wed, Oct 15, 2014 at 11:12 AM, Terry Reedy tjre...@udel.edu wrote:
 On 10/15/2014 10:32 AM, Chris “Kwpolska” Warrick wrote:
 It should parse this as

 else:
  print 'false'
  print 'done'

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


 There is no such rule in Python so it hardly dependable for auto indenting.

I agree. I very rarely use blank lines inside functions. As I see it,
if you feel you need a blank line for separation within a function,
that's an indication your function is overly complex and should be
broken up.

Keeping blank lines out of functions also makes it easy to copy/paste
those functions into the interactive interpreter, which can be handy
e.g. when sharing snippets of code by email.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Creating a counter

2014-10-15 Thread Terry Reedy

On 10/15/2014 2:39 PM, Shiva wrote:

Hi,

I am trying to search a string through files in a directory - however while
Python script works on it and writes a log - I want to present the user with
count of number of strings found. So it should increment for each string found.

How do I implement it?


n=0 before the look and
n += 1 withing the loop

--
Terry Jan Reedy

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


Re: Creating a counter

2014-10-15 Thread Vincent Vande Vyvre

Le 15/10/2014 20:39, Shiva a écrit :

Hi,

I am trying to search a string through files in a directory - however while
Python script works on it and writes a log - I want to present the user with
count of number of strings found. So it should increment for each string found.

How do I implement it?

If I use a print() within a if condition statement - and execute the script
in terminal - for each find, the print() prints in new line instead of a
constantly incrementing counter.

Thanks,
Shiva


Try this:

 def counter(x):
... for i in range(x):
... print \rProgress .. %s % i,
... sys.stdout.flush()
... time.sleep(1)
...
 counter(5)


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


Re: How to debug Python IDLE?

2014-10-15 Thread ryguy7272
On Wednesday, October 15, 2014 3:23:22 PM UTC-4, Terry Reedy wrote:
 On 10/15/2014 3:09 PM, ryguy7272 wrote:
 
  I'm wondering how to debug code in IDLE Python 3.4.  I found this.
 
 
 
 Use 3.4.2, which has an important bugfix for debugger.
 
 
 
  http://www.cs.uky.edu/~paulp/CS115F11/notes/debug/debug.html
 
 
 
  That looks pretty helpful,
 
 
 
  but mine is nothing like that.  All my controls are greyed out.
 
 
 
 That is normal when you first turn debugger on.  You have to load a file 
 
 in the editor and then run it (F5).  On the site above, the file is 
 
 volume.py.  The the debugger is 'activated'.
 
 
 
 -- 
 
 Terry Jan Reedy


Oh, I didn't know that's how it works.  ok.  Makes sense.  Something is still 
wrong though.  I have a file named 'test_script.py'.

Here's the code:

def showMaxFactor(num):
 count = num / 2
 while count  1:
  if num % count == 0:
  print 'largest factor of %d is %d' % \
   (num, count)
  break
  count -= 1
 else:
  print num, is prime
 for eachNum in range(10, 21):
  showMaxFactor(eachNum)

With the debugger ON, I hit F5 and get this.
'Expected an indent block'

I wouldn't say that's debugging anything.  I can't tell what line is throwing 
the error, or how to fix it.

Any thoughts?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Creating a counter

2014-10-15 Thread MRAB

On 2014-10-15 20:24, Vincent Vande Vyvre wrote:

Le 15/10/2014 20:39, Shiva a écrit :

Hi,

I am trying to search a string through files in a directory -
however while Python script works on it and writes a log - I want
to present the user with count of number of strings found. So it
should increment for each string found.

How do I implement it?

If I use a print() within a if condition statement - and execute
the script in terminal - for each find, the print() prints in new
line instead of a constantly incrementing counter.


 Try this:

def counter(x):
 ... for i in range(x):
 ... print \rProgress .. %s % i,
 ... sys.stdout.flush()
 ... time.sleep(1)
 ...
counter(5)

In Python 3, you can specify what to do at the end of the print.
Normally it prints a newline, but you can make it print nothing at the
end, leaving the cursor just after the last thing printed:

 def counter(x):
... for i in range(x):
... print(\rProgress .. %s % i, end=)
... sys.stdout.flush()
... time.sleep(1)
...
 counter(5)

The \r moves the cursor back to the start of the line so that it
overwrites what was printed last time.
--
https://mail.python.org/mailman/listinfo/python-list


Re: How to debug Python IDLE?

2014-10-15 Thread MRAB

On 2014-10-15 20:36, ryguy7272 wrote:

On Wednesday, October 15, 2014 3:23:22 PM UTC-4, Terry Reedy wrote:

On 10/15/2014 3:09 PM, ryguy7272 wrote:

 I'm wondering how to debug code in IDLE Python 3.4.  I found this.



Use 3.4.2, which has an important bugfix for debugger.



 http://www.cs.uky.edu/~paulp/CS115F11/notes/debug/debug.html



 That looks pretty helpful,



 but mine is nothing like that.  All my controls are greyed out.



That is normal when you first turn debugger on.  You have to load a file

in the editor and then run it (F5).  On the site above, the file is

volume.py.  The the debugger is 'activated'.



--

Terry Jan Reedy



Oh, I didn't know that's how it works.  ok.  Makes sense.  Something is still 
wrong though.  I have a file named 'test_script.py'.

Here's the code:

def showMaxFactor(num):
  count = num / 2
  while count  1:
   if num % count == 0:
   print 'largest factor of %d is %d' % \
(num, count)
   break
   count -= 1
  else:
   print num, is prime
  for eachNum in range(10, 21):
   showMaxFactor(eachNum)

With the debugger ON, I hit F5 and get this.
'Expected an indent block'

I wouldn't say that's debugging anything.  I can't tell what line is throwing 
the error, or how to fix it.

Any thoughts?


The 'print' line is indented the same as the 'if' line.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Creating a counter

2014-10-15 Thread Gary Herron

On 10/15/2014 11:39 AM, Shiva wrote:

Hi,

I am trying to search a string through files in a directory - however while
Python script works on it and writes a log - I want to present the user with
count of number of strings found. So it should increment for each string found.

How do I implement it?

If I use a print() within a if condition statement - and execute the script
in terminal - for each find, the print() prints in new line instead of a
constantly incrementing counter.

Thanks,
Shiva



The question seems confuse the word increment.

If you are asking how to count, plenty of responders have answered
count = count+1
and similar.

However, the second paragraphs seems to use the word increment to mean 
displaying the counter on a single line overwriting itself instead of a 
scrolling list of values one-per-line.  The solution may depend on what 
is displaying the value as you write it out, but if it's a 
terminal/command-prompt /console-window, then you want the write to 
finish with a carriage-return alone instead of a 
carriage-return/new-line combination.  In Python that is represented 
with a \r instead of a \n.


Python2:
  print counter, '\r', # The ending comma means do NOT output the usual \n

Python3:
  print(counter, end='\r')

Gary Herron

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


Re: How to debug Python IDLE?

2014-10-15 Thread ryguy7272
On Wednesday, October 15, 2014 3:10:05 PM UTC-4, ryguy7272 wrote:
 I'm wondering how to debug code in IDLE Python 3.4.  I found this.
 
 http://www.cs.uky.edu/~paulp/CS115F11/notes/debug/debug.html
 
 
 
 That looks pretty helpful, but mine is nothing like that.  All my controls 
 are greyed out.  The debugger does basically...nothing.  All I get is 
 messages like this.
 
 
 
 [DEBUG ON]
 
  
 
 [DEBUG OFF]
 
  
 
 [DEBUG ON]
 
  
 
 
 
 It doesn't debug anything at all.
 
 
 
 Any idea what's wrong?
 
 Thanks.


Yes.  exactly.  So why is it throwing an error and how can I truly debug it?  
Normally, you can step through code line by line, but I don't see any way to do 
this using Python.

Man, I've been in all kinds of development roles, for over 10 years, using all 
kinds of languages, and I've never worked with anything as difficult as Python. 
 It seems so simple, but actually nothing works for me.  I've read 4 books on 
Python and I've been working on small snippets of code, for 2 months now.  
Almost nothing at all has worked for me.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to debug Python IDLE?

2014-10-15 Thread Mark Lawrence

On 15/10/2014 21:45, ryguy7272 wrote:

On Wednesday, October 15, 2014 3:10:05 PM UTC-4, ryguy7272 wrote:

I'm wondering how to debug code in IDLE Python 3.4.  I found this.

http://www.cs.uky.edu/~paulp/CS115F11/notes/debug/debug.html



That looks pretty helpful, but mine is nothing like that.  All my controls are 
greyed out.  The debugger does basically...nothing.  All I get is messages like 
this.



[DEBUG ON]





[DEBUG OFF]





[DEBUG ON]







It doesn't debug anything at all.



Any idea what's wrong?

Thanks.



Yes.  exactly.  So why is it throwing an error and how can I truly debug it?  
Normally, you can step through code line by line, but I don't see any way to do 
this using Python.

Man, I've been in all kinds of development roles, for over 10 years, using all 
kinds of languages, and I've never worked with anything as difficult as Python. 
 It seems so simple, but actually nothing works for me.  I've read 4 books on 
Python and I've been working on small snippets of code, for 2 months now.  
Almost nothing at all has worked for me.



What did you not understand about the answers given by Terry Reedy and 
MRAB?  Why are you using a debugger, I can't remember the last time I 
needed one with Python?  Please don't try to fight the language, use the 
1000s of man years experience here to make life easier for yourself. 
Even if you've no Java experience try reading this 
http://dirtsimple.org/2004/12/python-is-not-java.html and this 
http://dirtsimple.org/2004/12/java-is-not-python-either.html to get a 
feel for Python.  If you haven't read the Zen of Python do that as well. 
 I'll let you look that one up :)


Further would you please access this list via 
https://mail.python.org/mailman/listinfo/python-list or read and action 
this https://wiki.python.org/moin/GoogleGroupsPython to prevent us 
seeing double line spacing and single line paragraphs, thanks.


--
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: Parsing Python dictionary with multiple objects

2014-10-15 Thread Dave Angel
Anurag Patibandla anuragpatiband...@gmail.com Wrote in message:
 On Wednesday, October 15, 2014 1:35:43 PM UTC-4, Rustom Mody wrote:
 On Wednesday, October 15, 2014 10:51:11 PM UTC+5:30, Anurag Patibandla wrote:
 
  Here is my sample dict if that helps:
 
  
 
  
 
  
 
  json = {1: {Status: Submitted, Startdate: [01/01/2011], 
  Enddate: [02/02/2012], Job_ID: 1, m_Quantile: 80, 
  m_Controller: Python, m_Method: Distributed, Allocation_3: 
  [50], Allocation_2: [30], Allocation_1: [20], Note: , 
  m_Iterations: 1000, submit: [Submit], VaR: , Asset_2: 
  [YHOO], Asset_3: [CAT], Asset_1: [AAPL]}, 3: {Status: 
  Submitted, Startdate: [01/01/2011], Enddate: [02/02/2012], 
  Job_ID: 3, m_Quantile: 90, m_Controller: Python, m_Method: 
  Distributed, Allocation_3: [50], Allocation_2: [30], 
  Allocation_1: [20], Note: , m_Iterations: 1000, submit: 
  [Submit], VaR: , Asset_2: [YHOO], Asset_3: [CAT], Asset_1: 
  [AAPL]}, 2: {Status: Submitted, Startdat
  e: [01/01/2011], Enddate: [02/02/2012], Job_ID: 2, m_Quantile: 
 80, m_Controller: Python, m_Method: GARCH, Allocation_3: [50], 
 Allocation_2: [30], Allocation_1: [20],
   Note: , m_Iterations: 1000, submit: [Submit], VaR: , 
 Asset_2: [YHOO], Asset_3: [CAT], Asset_1: [AAPL]}, 4: 
 {Status: Submitted, Startdate: [01/01/2011], Enddate: 
 [02/02/2012], Job_ID: 4, m_Quantile: 90, m_Controller: Python, 
 m_Method: GARCH, Allocation_3: [50], Allocation_2: [30], 
 Allocation_1: [20], Note: , m_Iterations: 1000, submit: 
 [Submit], VaR: , Asset_2: [YHOO], Asset_3: [CAT], Asset_1: 
 [AAPL]}}
 
 
 
 Right
 
 So your dict (which is dicts !) we have
 
  json.keys()
 
 ['1', '3', '2', '4']
 
 
 
 And so
 
 
 
  json[0]
 
 Traceback (most recent call last):
 
   File stdin, line 1, in module
 
 KeyError: 0
 
 
 
  json['0']
 
 Traceback (most recent call last):
 
   File stdin, line 1, in module
 
 KeyError: '0'
 
 
 
  json['1']
 
 {'Status': 'Submitted', 'Startdate': ['01/01/2011'], 'Enddate': 
 ['02/02/2012'], 'Job_ID': 1, 'm_Quantile': '80', 'Allocation_3': ['50'], 
 'm_Method': 'Distributed', 'm_Controller': 'Python', 'Allocation_2': ['30'], 
 'Allocation_1': ['20'], 'Asset_2': ['YHOO'], 'Note': '', 'VaR': '', 
 'submit': ['Submit'], 'm_Iterations': '1000', 'Asset_3': ['CAT'], 'Asset_1': 
 ['AAPL']}
 
 
 
 IOW 0 is not a key 
 
 Neither is '0' (the string containing the char 0)
 
 But the string '1' is a valid key
 
 Yes, but I can't just do 'json['1']', at the end of the code I need to do a 
 'dicts['1']', or 'dicts['2']', to get the smaller dicts which still gives me 
 a 'KeyError: 1'
 

Did you read the code I supplied, where you would wind up with
 three variables, dict1, ict2, and dict3? Just before assigning
 those, I had a LIST of dicts.  Such a list can be accessed by
 threedicts [0] to get the first dictionary, threedicts [1] to get
 the next, etc.


-- 
DaveA

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


Question About Running Python code

2014-10-15 Thread ryguy7272
I'm trying to run this script (using IDLE 3.4)

#!/usr/bin/env python

import urllib2
import pytz
import pandas as pd

from bs4 import BeautifulSoup
from datetime import datetime
from pandas.io.data import DataReader


SITE = http://en.wikipedia.org/wiki/List_of_S%26P_500_companies;
START = datetime(1900, 1, 1, 0, 0, 0, 0, pytz.utc)
END = datetime.today().utcnow()


def scrape_list(site):
hdr = {'User-Agent': 'Mozilla/5.0'}
req = urllib2.Request(site, headers=hdr)
page = urllib2.urlopen(req)
soup = BeautifulSoup(page)

table = soup.find('table', {'class': 'wikitable sortable'})
sector_tickers = dict()
for row in table.findAll('tr'):
col = row.findAll('td')
if len(col)  0:
sector = str(col[3].string.strip()).lower().replace(' ', '_')
ticker = str(col[0].string.strip())
if sector not in sector_tickers:
sector_tickers[sector] = list()
sector_tickers[sector].append(ticker)
return sector_tickers


def download_ohlc(sector_tickers, start, end):
sector_ohlc = {}
for sector, tickers in sector_tickers.iteritems():
print 'Downloading data from Yahoo for %s sector' % sector
data = DataReader(tickers, 'yahoo', start, end)
for item in ['Open', 'High', 'Low']:
data[item] = data[item] * data['Adj Close'] / data['Close']
data.rename(items={'Open': 'open', 'High': 'high', 'Low': 'low',
   'Adj Close': 'close', 'Volume': 'volume'},
inplace=True)
data.drop(['Close'], inplace=True)
sector_ohlc[sector] = data
print 'Finished downloading data'
return sector_ohlc


def store_HDF5(sector_ohlc, path):
with pd.get_store(path) as store:
for sector, ohlc in sector_ohlc.iteritems():
store[sector] = ohlc


def get_snp500():
sector_tickers = scrape_list(SITE)
sector_ohlc = download_ohlc(sector_tickers, START, END)
store_HDF5(sector_ohlc, 'snp500.h5')


if __name__ == '__main__':
get_snp500()


I got it from this link.
http://www.thealgoengineer.com/2014/download_sp500_data/

I'm just about going insane here.  I've been doing all kinds of computer 
programming for 11 years, and I know 10 languages.  I'm trying to learn Python 
now, but this makes no sense to me.  

I would be most appreciative if someone could respond to a few questions.

The error that I get is this.
'invalid syntax'

The second single quote in this line is highlighted pink.
print 'Downloading data from Yahoo for %s sector' % sector

#1)  That's very bizarre to mix single quotes and double quotes in a single 
language.  Does Python actually mix single quotes and double quotes?  

#2)  In the Python 3.4 Shell window, I turn the debugger on by clicking 
'Debugger'.  Then I run the file I just created; it's called 'stock.py'.  I get 
the error immediately, and I can't debug anything so I can't tell what's going 
on.  This is very frustrating.  All the controls in the debugger are greyed 
out.  What's up with the debugger?

#3)  My final question is this?  How do I get this code running?  It seems like 
there is a problem with a single quote, which is just silly.  I can't get the 
debugger working, so I can't tell what's going on.  The only thins I know, or I 
think I know, is that the proper libraries seem to be installed, so that's one 
thing that's working.


I'd really appreciate it if someone could please answer my questions and help 
me get this straightened out, so I can have some fun with Python.  So far, I've 
spent 2 months reading 4 books, and trying all kinds of sample code...and 
almost every single thing fails and I have no idea why.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Question About Running Python code

2014-10-15 Thread Dan Stromberg
On Wed, Oct 15, 2014 at 3:50 PM, ryguy7272 ryanshu...@gmail.com wrote:
 I'm trying to run this script (using IDLE 3.4)

 I would be most appreciative if someone could respond to a few questions.

 The error that I get is this.
 'invalid syntax'

You may get better help if you give the context of this message.

 The second single quote in this line is highlighted pink.
 print 'Downloading data from Yahoo for %s sector' % sector

 #1)  That's very bizarre to mix single quotes and double quotes in a single 
 language.  Does Python actually mix single quotes and double quotes?

I'm not sure what you mean by mix.  C uses single quotes and double
quotes, right?

Python treats single quotes and double quotes pretty much
interchangeably, except if you start a string with a single quote (for
example), you can easily put a double quote inside it, and you must
terminate the string with another single quote.  And vice versa.

 #2)  In the Python 3.4 Shell window, I turn the debugger on by clicking 
 'Debugger'.  Then I run the file I just created; it's called 'stock.py'.  I 
 get the error immediately, and I can't debug anything so I can't tell what's 
 going on.  This is very frustrating.  All the controls in the debugger are 
 greyed out.  What's up with the debugger?

You have Python 2.x code there.  The differences between 2.x and 3.x
are far from insurmountable, but it does require a little code
adjustment.  If you're a python novice, you might be better off
running this under 2.x.

I believe your debugger won't help until your code compiles.

 #3)  My final question is this?  How do I get this code running?  It seems 
 like there is a problem with a single quote, which is just silly.  I can't 
 get the debugger working, so I can't tell what's going on.  The only thins I 
 know, or I think I know, is that the proper libraries seem to be installed, 
 so that's one thing that's working.

The print statement in 2.x has been made a print function in 3.x;
that's likely necessary to fix, though not necessarily sufficient.

EG in 2.x:
print 'hello word', 6

while in 3.x that would be:
print('hello world', 6)

Interestingly, you can write a single command that works in both with:
print('hello world {}'.format(6))

To 2.x, it's printing the result of a parenthesized expression.  To
3.x, it's a function call with one argument.


 I'd really appreciate it if someone could please answer my questions and help 
 me get this straightened out, so I can have some fun with Python.  So far, 
 I've spent 2 months reading 4 books, and trying all kinds of sample 
 code...and almost every single thing fails and I have no idea why.

You may also need to install pytz, pandas and BeautifulSoup.  I favor
pip or pip3 for such things.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-10-15 Thread alex23

On 16/10/2014 12:32 AM, Chris “Kwpolska” Warrick wrote:

It should parse this as

else:
 print 'false'
 print 'done'

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

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

print 'done'

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


I don't think it makes any sense at all, for two reasons:

1) Empty lines have no such semantic meaning in Python.
2) Anything that strips tabs is just as likely to strip EOLs.

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


Import Doesn't Import

2014-10-15 Thread ryguy7272
So sorry everyone.  I've posted here several times today.  This is VERY 
frustrating.

So, I'm reading this link.
https://docs.python.org/2/howto/urllib2.html


Fetching URLs
The simplest way to use urllib2 is as follows:
import urllib2
response = urllib2.urlopen('http://python.org/')
html = response.read()


So, I fire up Python, and create a new file and name it and hit F5.

All I have is thins in the file:
import urllib2
response = urllib2.urlopen('http://python.org/')
html = response.read()

It immediately produces this error:
Traceback (most recent call last):
  File C:/Python34/import_web_data.py, line 1, in module
import urllib2
ImportError: No module named 'urllib2'


ImportError: No module named 'urllib2'
I'm telling Python to import because it doesn't exist and it throws an error.  
I don't get it; I just don't get it.  If I'm working with R, I can import 
thousands of libraries with no errors whatsoever.  With Python, I just get 
thousands of errors with nothing working whatsoever.  I totally don't 
understand this language.  Import means import.  Right.  WTF!

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


Re: Import Doesn't Import

2014-10-15 Thread ryguy7272
On Wednesday, October 15, 2014 8:40:40 PM UTC-4, ryguy7272 wrote:
 So sorry everyone.  I've posted here several times today.  This is VERY 
 frustrating.
 
 
 
 So, I'm reading this link.
 
 https://docs.python.org/2/howto/urllib2.html
 
 
 
 
 
 Fetching URLs
 
 The simplest way to use urllib2 is as follows:
 
 import urllib2
 
 response = urllib2.urlopen('http://python.org/')
 
 html = response.read()
 
 
 
 
 
 So, I fire up Python, and create a new file and name it and hit F5.
 
 
 
 All I have is thins in the file:
 
 import urllib2
 
 response = urllib2.urlopen('http://python.org/')
 
 html = response.read()
 
 
 
 It immediately produces this error:
 
 Traceback (most recent call last):
 
   File C:/Python34/import_web_data.py, line 1, in module
 
 import urllib2
 
 ImportError: No module named 'urllib2'
 
 
 
 
 
 ImportError: No module named 'urllib2'
 
 I'm telling Python to import because it doesn't exist and it throws an error. 
  I don't get it; I just don't get it.  If I'm working with R, I can import 
 thousands of libraries with no errors whatsoever.  With Python, I just get 
 thousands of errors with nothing working whatsoever.  I totally don't 
 understand this language.  Import means import.  Right.  WTF!


Either this is the most brilliant thing ever invented, or it's the biggest 
piece of shit ever invented.  I just can't tell.  All I know for sure, is that 
it doesn't do ANYTHING that I tell it to do.  

If there is another way of running Python code, like using Visual Studio, or a 
text file, or some such thing, let me know, and I'll do it.  It seems like you 
should use Python to run Python, but my Python doesn't do anything at all.  
Yesterday I uninstalled Python 2.7, because that wouldn't do anything either.  
I'm just about ready to uninstall 3.4.

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


Re: Import Doesn't Import

2014-10-15 Thread Chris Angelico
On Thu, Oct 16, 2014 at 11:40 AM, ryguy7272 ryanshu...@gmail.com wrote:
 I totally don't understand this language.  Import means import.  Right.  
 WTF!

Yes, but import from where? If you ask Python - or any other language
- to import asfadgt4tfihavzcxvzxcvaerg, do you expect it to succeed?
It doesn't exist.

In this case, you simply want urllib, not urllib2. You should be
able to import urllib with no problems.

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


Re: Question About Running Python code

2014-10-15 Thread Cameron Simpson

On 15Oct2014 16:09, Dan Stromberg drsali...@gmail.com wrote:

On Wed, Oct 15, 2014 at 3:50 PM, ryguy7272 ryanshu...@gmail.com wrote:
#1)  That's very bizarre to mix single quotes and double quotes in a single 
 language.  Does Python actually mix single quotes and double quotes?


I'm not sure what you mean by mix.  C uses single quotes and double
quotes, right?


Yes, but it uses single quotes for characters (a single byte integer type) and 
double quotes for strings. Python doesn't really have a single character type, 
and lets the user use either quote mark as they see fit. Ryan finds this 
unfamiliar.


Cheers,
Cameron Simpson c...@zip.com.au

BTW, don't bother flaming me. I can't read.
- afde...@lims03.lerc.nasa.gov (Stephen Dennison)
--
https://mail.python.org/mailman/listinfo/python-list


Re: Import Doesn't Import

2014-10-15 Thread Dan Stromberg
On Wed, Oct 15, 2014 at 5:40 PM, ryguy7272 ryanshu...@gmail.com wrote:

 ImportError: No module named 'urllib2'

http://stackoverflow.com/questions/2792650/python3-error-import-error-no-module-name-urllib
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Import Doesn't Import

2014-10-15 Thread MRAB

On 2014-10-16 01:40, ryguy7272 wrote:

So sorry everyone.  I've posted here several times today.  This is
VERY frustrating.


 So, I'm reading this link.
 https://docs.python.org/2/howto/urllib2.html


 Fetching URLs
 The simplest way to use urllib2 is as follows:
 import urllib2
 response = urllib2.urlopen('http://python.org/')
 html = response.read()


 So, I fire up Python, and create a new file and name it and hit F5.

 All I have is thins in the file:
 import urllib2
 response = urllib2.urlopen('http://python.org/')
 html = response.read()

 It immediately produces this error:
 Traceback (most recent call last):
File C:/Python34/import_web_data.py, line 1, in module
  import urllib2
 ImportError: No module named 'urllib2'


 ImportError: No module named 'urllib2'
 I'm telling Python to import because it doesn't exist and it throws
 an error.  I don't get it; I just don't get it.  If I'm working with
 R, I can import thousands of libraries with no errors whatsoever.
 With Python, I just get thousands of errors with nothing working
 whatsoever.  I totally don't understand this language.  Import means
 import.  Right.  WTF!

It raises an exception because there's no such module as 'urllib2' in
Python 3.

You're reading the docs here:

https://docs.python.org/2/howto/urllib2.html

which are for Python 2, but the path you have here:

C:/Python34/import_web_data.py

says that you're using Python 3.4.

There's an explanation of Python 2 vs Python 3 here:

https://wiki.python.org/moin/Python2orPython3
--
https://mail.python.org/mailman/listinfo/python-list


Re: Import Doesn't Import

2014-10-15 Thread Dan Stromberg
On Wed, Oct 15, 2014 at 5:44 PM, ryguy7272 ryanshu...@gmail.com wrote:

 Either this is the most brilliant thing ever invented, or it's the biggest 
 piece of shit ever invented.  I just can't tell.  All I know for sure, is 
 that it doesn't do ANYTHING that I tell it to do.

Maybe you should decide whether you want to run your 2.x code on 2.7,
or adapt it to 3.x.  Doing both won't work well, unless you go with a
version of the code carefully constructed to work on both.

I believe I heard there's a way of doing Python in Visual Studio, but
personally, I use Python on Linux without an IDE - mostly via a vim
macro.

BTW, I got your code to run, but it got stuck in a socket.recv(); I
suspect Wikipedia is blocking some forms of access, so this labor may
be irrelevant.

Perhaps check out
https://pypi.python.org/pypi?%3Aaction=searchterm=stocksubmit=search
, and use the most relevant-looking one with a matching version of
Python?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Question About Running Python code

2014-10-15 Thread Ian Kelly
On Oct 15, 2014 7:04 PM, Cameron Simpson c...@zip.com.au wrote:

 On 15Oct2014 16:09, Dan Stromberg drsali...@gmail.com wrote:

 On Wed, Oct 15, 2014 at 3:50 PM, ryguy7272 ryanshu...@gmail.com wrote:

 #1)  That's very bizarre to mix single quotes and double quotes in a
single  language.  Does Python actually mix single quotes and double
quotes?


 I'm not sure what you mean by mix.  C uses single quotes and double
 quotes, right?


 Yes, but it uses single quotes for characters (a single byte integer
type) and double quotes for strings. Python doesn't really have a single
character type, and lets the user use either quote mark as they see fit.
Ryan finds this unfamiliar.

In any case, it's hardly bizarre; it's common among interpreted languages.
Other languages that allow both single- and double-quote strings include
ECMAScript and Lua. Perl, PHP and Ruby also have both variants but
distinguish between them for interpolation.
-- 
https://mail.python.org/mailman/listinfo/python-list


Python 3 is the active language, recommended for newcomers (was: Import Doesn't Import)

2014-10-15 Thread Ben Finney
ryguy7272 ryanshu...@gmail.com writes:

 So, I'm reading this link.
 https://docs.python.org/2/howto/urllib2.html

Note that this is the documentation for Python 2, which is obsolescent.
It has had a long life, so references to Python on the web are still
dominantly about that legacy version. Your confusion is quite normal.

Instead, use Python 3 only (which it seems you are doing), and read the
Python 3 documentation. You'll find that the ‘urllib’ modules
URL:https://docs.python.org/3/library/urllib.html are what you want.

 I don't get it; I just don't get it.

It's unfortunate that a lot of new Python users will be confused by this
long transition. But the situation is a lot better now; more and more
Python articles on the web are referring to Python 3 which is the
actively-developed version, recommended for new users.

-- 
 \ “You don't need a book of any description to help you have some |
  `\kind of moral awareness.” —Dr. Francesca Stavrakoloulou, bible |
_o__)  scholar, 2011-05-08 |
Ben Finney

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


Re: Import Doesn't Import

2014-10-15 Thread Chris Rebert
On Wednesday, October 15, 2014, ryguy7272 ryanshu...@gmail.com wrote:

 So sorry everyone.  I've posted here several times today.  This is VERY
 frustrating.

 So, I'm reading this link.
 https://docs.python.org/2/howto/urllib2.html



Important note!: The /2/ in the URL means those docs are for Python 2.x
When using Python 3, ensure that the docs you're consulting have a /3/ in
them instead.


 Fetching URLs
 The simplest way to use urllib2 is as follows:
 import urllib2
 response = urllib2.urlopen('http://python.org/')
 html = response.read()


 So, I fire up Python, and create a new file and name it and hit F5.

 All I have is thins in the file:
 import urllib2
 response = urllib2.urlopen('http://python.org/')
 html = response.read()

 It immediately produces this error:
 Traceback (most recent call last):
   File C:/Python34/import_web_data.py, line 1, in module
 import urllib2
 ImportError: No module named 'urllib2'


You're using Python 3, and the urllib2 module no longer exists in Python 3.
The URL/HTTP modules got refactored on Python 3. You want the
`urllib.request` module instead.

Although most folks nowadays use http://docs.python-requests.org/ instead,
though it's third-party and outside the std lib.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to debug Python IDLE?

2014-10-15 Thread Terry Reedy

On 10/15/2014 3:36 PM, ryguy7272 wrote:

Please pay attention to Mark's comment about how to avoid blank line 
doubling.



def showMaxFactor(num):
  count = num / 2
  while count  1:
   if num % count == 0:
   print 'largest factor of %d is %d' % \
(num, count)
   break
   count -= 1
  else:
   print num, is prime
  for eachNum in range(10, 21):
   showMaxFactor(eachNum)

With the debugger ON, I hit F5 and get this.
'Expected an indent block'


You saw that in a Syntax Error box.


I wouldn't say that's debugging anything.


Quite the opposite.  Idle checks syntax before running the code since 
running the code would produce the same error anyway.


 I can't tell what line is throwing the error, or how to fix it.

When you click OK on the box, the editor window is display with the 
error marked in red background.  In this case, that should be 'print' 
with red background.  If you indent print and run again, you should, if 
running 3.x, see 'Missing parenthesis...' and another red marking.


--
Terry Jan Reedy

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


Re: Import Doesn't Import

2014-10-15 Thread Terry Reedy

Perhaps you are trying too hard too fast.  When I started Python, after
20 years of on and off experience with multiple languages, I went
through the tutorial (on Dos, no Idle).  It took about 2 hours. Then I
quickly wrote the code I needed for a paid project.

Do stick with 3.4.2, but use the 3.4.2 manual.

On 10/15/2014 8:44 PM, ryguy7272 wrote:


Either this is the most brilliant thing ever invented,


This, I think.

 or it's the biggest piece of shit ever invented.

Definitely not.  It is possible that Python will never fit your brain. 
But give it a bit more of a chance.


 All I know for sure, is that it doesn't do ANYTHING
 that I tell it to do.

Because you have told it to do things like run a program with syntax 
error, or import something that does not exist.  I don't know of any 
language than does that ;-).


--
Terry Jan Reedy

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


[issue22637] avoid using a shell in uuid: replce os.popen with subprocess.Popen

2014-10-15 Thread STINNER Victor

STINNER Victor added the comment:

Arfrever wrote me on IRC:
 Your patch for issue #22637 has print(executable)

Ooops. Updated patch without the print.

--
Added file: http://bugs.python.org/file36930/uuid_popen-2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22637
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22627] Calling timestamp() on a datetime object modifies the timestamp of a different datetime object.

2014-10-15 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Christopher, I've already pointed out a fix in another message: just remove 
.replace(tzinfo=None). Doing computations on UTC datetimes (rather than 
naive) should ensure you don't encounter any ambiguities.

--
resolution:  - not a bug
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22627
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21338] Silent mode for compileall

2014-10-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 34436ae65523 by Berker Peksag in branch 'default':
Issue #21338: Add silent mode for compileall.
https://hg.python.org/cpython/rev/34436ae65523

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21338
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21338] Silent mode for compileall

2014-10-15 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the patch, Thomas.

--
resolution:  - fixed
stage: commit review - resolved
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21338
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22638] ssl module: the SSLv3 protocol is vulnerable (POODLE attack)

2014-10-15 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Matthew Green posted a nice explanation of the attack:
http://blog.cryptographyengineering.com/2014/10/attack-of-week-poodle.html

In short, currently it requires injection of code into the browser (i.e. SSL 
client) to be exploitable. While that's easy on the WWW, it's not necessarily 
possible with other protocols.

I think we could strengthen all stdlib *servers* because third-party clients 
are generally more up-to-date than third-party servers, so we risk less 
disruption. That may involve a separate _create_stdlib_server_context() 
function.

Besides, I think that, independently of this, we could strengthen 
_create_stdlib_context() in 3.5.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22638
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22640] Add silent mode for py_compile

2014-10-15 Thread Berker Peksag

New submission from Berker Peksag:

This is similar to issue 21338.

It would be good to add a new option -q to the CLI interface and add a new 
parameter quiet to py_compile.compile() (e.g. if doraise is False and quiet 
is True, do not print anything).

--
assignee: berker.peksag
components: Library (Lib)
messages: 229409
nosy: berker.peksag
priority: normal
severity: normal
stage: needs patch
status: open
title: Add silent mode for py_compile
type: enhancement
versions: Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22640
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22638] ssl module: the SSLv3 protocol is vulnerable (POODLE attack)

2014-10-15 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Hmm... of course, stdlib servers don't use create_stdlib_context() in 2.7. 
We'll have to do it by hand :)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22638
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22638] ssl module: the SSLv3 protocol is vulnerable (POODLE attack)

2014-10-15 Thread Cory Benfield

Cory Benfield added the comment:

 I don't believe it's in OpenSSL though.

There's an outstanding OpenSSL patch: 
http://marc.info/?l=openssl-devm=141333049205629w=2

However, as Donald has pointed out, this is really only meaningful for servers 
and co-operating clients. It's not a useful panacea.

--
nosy: +Lukasa

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22638
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3068] IDLE - Add an extension configuration dialog

2014-10-15 Thread Terry J. Reedy

Terry J. Reedy added the comment:

This version only allows configuration of default configuration.  Added 
sections (for added extensions) are ignored.  That will be a future enhancement.

Patch 5 makes changes in load_extensions and set_user_value so that var strings 
are compared to saved default strings. Before doing that, the value is stripped 
and if blank replaced with the default.  The var is set to the adjusted value.  
After Apply, the user can see what the current config values are and if not 
default, what was written to the user config file.

--
Added file: http://bugs.python.org/file36931/cfg-ext-34-5.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue3068
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22631] Feature Request CAN_RAW_FD_FRAMES

2014-10-15 Thread Stefan Tatschner

Changes by Stefan Tatschner ste...@sevenbyte.org:


--
title: Feature Request CAN_RAW_FD_FRAME - Feature Request CAN_RAW_FD_FRAMES

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22631
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21991] The new email API should use MappingProxyType instead of returning new dicts.

2014-10-15 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

Tell me if you will review this patch and maybe accept it ;-)

In fact I checked all the return keywords in the email library and I didn't 
find any other copy of a dict.

This is the reason why I am dubious about my patch ;-)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21991
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3068] IDLE - Add an extension configuration dialog

2014-10-15 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Patch 5 was missing the last change. Ignore it unless here is a problem with 5a

--
Added file: http://bugs.python.org/file36932/cfg-ext-34-5a.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue3068
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22237] sorted() docs should state that the sort is stable

2014-10-15 Thread Mark Dickinson

Mark Dickinson added the comment:

 when I grep the code, I don't find it

The non-greppability is due to preprocessor evil. The culprit is this macro 
from Include/object.h:

  #define _Py_IDENTIFIER(varname) _Py_static_string(PyId_##varname, #varname)

along with the declaration

  _Py_IDENTIFIER(sort);

earlier in bltinmodule.c.

--
nosy: +mark.dickinson

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22237
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22237] sorted() docs should state that the sort is stable

2014-10-15 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

Hi Mark,

Without your explanation, I was really lost.

Thank you.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22237
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22638] ssl module: the SSLv3 protocol is vulnerable (POODLE attack)

2014-10-15 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Update on 2.7:
- there are no SSL servers in the stdlib (ha)
- SSL clients don't do any auto-downgrading

so it's not obvious we should patch something (if people choose to pass 
PROTOCOL_SSLv3, it's their problem).

Update on 3.4:
- the only SSL server in the stdlib is in asyncio, but it forces the user to 
pass their own SSL context (good!)
- SSL clients don't do any auto-downgrading

(3.5 should be similar)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22638
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20386] socket.SocketType enum overwrites import of _socket.SocketType

2014-10-15 Thread Berker Peksag

Berker Peksag added the comment:

+ self.assertTrue(socket.SocketType is _socket.socket)

You can use assertIs instead of assertTrue.

--
nosy: +berker.peksag
versions: +Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20386
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22638] ssl module: the SSLv3 protocol is vulnerable (POODLE attack)

2014-10-15 Thread Martin Richard

Changes by Martin Richard mart...@martiusweb.net:


--
nosy: +martius

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22638
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22237] sorted() docs should state that the sort is stable

2014-10-15 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

My patch for the documentation of Python 3.5, just need a small feedback.

If you agree with this patch, I will provide the same patch for 2.7 and 3.4

Thank you

--
keywords: +patch
Added file: http://bugs.python.org/file36933/issue22237.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22237
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13236] unittest needs more flush calls

2014-10-15 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

ping about this bug, do you have the same problem with the last version of 
Python 3.4 and with Python 2.7.8 ?

--
nosy: +matrixise

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13236
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17095] Modules/Setup *shared* support broken

2014-10-15 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

Hi Ned,

What are the news for this issue?

--
nosy: +matrixise

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17095
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11844] Update json to upstream simplejson latest release

2014-10-15 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

Hi all,

ping this issue for Python 3.5.

--
nosy: +matrixise

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11844
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21991] The new email API should use MappingProxyType instead of returning new dicts.

2014-10-15 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
stage: needs patch - patch review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21991
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22638] ssl module: the SSLv3 protocol is vulnerable (POODLE attack)

2014-10-15 Thread Christian Heimes

Christian Heimes added the comment:

There is no need for a _create_stdlib_server_context() function. 
_create_stdlib_context() takes a purpose argument, too.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22638
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21991] The new email API should use MappingProxyType instead of returning new dicts.

2014-10-15 Thread Stéphane Wirtel

Changes by Stéphane Wirtel steph...@wirtel.be:


Removed file: http://bugs.python.org/file36915/issue21991.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21991
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22641] Use better default context in asyncio

2014-10-15 Thread Antoine Pitrou

New submission from Antoine Pitrou:

asyncio is not yet bound by legacy use cases, so this patch switches asyncio to 
stronger default SSL settings for client connections. It also adds tests for 
that (the code path was untested).

--
components: Library (Lib), asyncio
files: asyncio_default_context.patch
keywords: patch
messages: 229424
nosy: alex, christian.heimes, giampaolo.rodola, gvanrossum, haypo, pitrou, 
yselivanov
priority: normal
severity: normal
stage: patch review
status: open
title: Use better default context in asyncio
type: security
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file36934/asyncio_default_context.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22641
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21991] The new email API should use MappingProxyType instead of returning new dicts.

2014-10-15 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

New version of the patch

--
Added file: http://bugs.python.org/file36935/issue21991.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21991
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21991] The new email API should use MappingProxyType instead of returning new dicts.

2014-10-15 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

sorry, but how to update a patch without losing the rietveld review? Is there a 
documentation about that?

Thanks.

Stephane

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21991
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22641] Use better default context in asyncio

2014-10-15 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


Removed file: http://bugs.python.org/file36934/asyncio_default_context.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22641
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22641] Use better default context in asyncio

2014-10-15 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


Added file: http://bugs.python.org/file36936/asyncio_default_context.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22641
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11844] Update json to upstream simplejson latest release

2014-10-15 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Development of simplejson and the standard json module has diverged. We may 
port selected fixes and features from simplejson, but I don't think a wholesale 
update is doable anymore.

Please open separate issues for each feature you would like to see added to the 
standard json module.

--
resolution:  - rejected
status: open - pending

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11844
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22634] importing _ctypes failed: undefined symbol: ffi_call_win32

2014-10-15 Thread Matthias Klose

Matthias Klose added the comment:

could somebody attach a build log from such a system? and the libffi config.log?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22634
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22634] importing _ctypes failed: undefined symbol: ffi_call_win32

2014-10-15 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +larry
priority: normal - release blocker
versions: +Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22634
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19450] Bug in sqlite in Windows binaries

2014-10-15 Thread Marc Schlaich

Marc Schlaich added the comment:

I've now run various and partially complex applications including SQLAlchemy 
against SQLite 3.8.1 for months without having any issues. Right now I have run 
extensive database test suites against the current SQLite release 3.8.6 without 
any issues, too.

So I would say it's save to bundle a newer SQLite version in the next Python 
2.7.x. Who would be responsible for this? Is there anything I can do to get 
progress on this issue?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19450
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20386] socket.SocketType enum overwrites import of _socket.SocketType

2014-10-15 Thread koobs

koobs added the comment:

This change looks to be implicated in a buildbot breakage on koobs-freebsd9 
(3.4).

I couldn't reproduce the test failure by re-running the build, so possibly 
intermittent or non-deterministic.

Full build log attached.

I'll leave the issue closed for now, please re-open if verified.

==
ERROR: test_pickling 
(test.test_multiprocessing_fork.WithProcessesTestPicklingConnections)
--
Traceback (most recent call last):
  File 
/usr/home/buildbot/python/3.4.koobs-freebsd9/build/Lib/test/_test_multiprocessing.py,
 line 2590, in test_pickling
self.assertEqual(new_conn.recv(), msg.upper())
  File 
/usr/home/buildbot/python/3.4.koobs-freebsd9/build/Lib/multiprocessing/connection.py,
 line 250, in recv
buf = self._recv_bytes()
  File 
/usr/home/buildbot/python/3.4.koobs-freebsd9/build/Lib/multiprocessing/connection.py,
 line 416, in _recv_bytes
buf = self._recv(4)
  File 
/usr/home/buildbot/python/3.4.koobs-freebsd9/build/Lib/multiprocessing/connection.py,
 line 389, in _recv
raise EOFError
EOFError

--
nosy: +koobs
Added file: http://bugs.python.org/file36937/koobs-freebsd9-py34-build-553.txt

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20386
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19450] Bug in sqlite in Windows binaries

2014-10-15 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Steve is responsible for the Windows builds, but he always answered to your 
request above.

--
nosy: +pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19450
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22638] ssl module: the SSLv3 protocol is vulnerable (POODLE attack)

2014-10-15 Thread Donald Stufft

Donald Stufft added the comment:

I really don't think it's unreasonable to say SSL 3.0 is insecure, if you rely 
on it then you need to pass this flag to use it. Passing a flag to do 
something insecure is hardly onerous.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22638
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19450] Bug in sqlite in Windows binaries

2014-10-15 Thread Mark Lawrence

Mark Lawrence added the comment:

A work around is already given in msg201796 and is reinforced by this 
https://mail.python.org/pipermail/python-list/2014-October/679369.html

--
nosy: +zach.ware

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19450
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >