Re: MySQLdb and conn.select_db() (Posting On Python-List Prohibited)

2017-11-15 Thread Lawrence D’Oliveiro
On Thursday, November 16, 2017 at 5:32:23 AM UTC+13, Tobiah wrote:

> AttributeError: 'Connection' object has no attribute 'select_db'

You could always execute a “use «db_name»” MySQL command.
-- 
https://mail.python.org/mailman/listinfo/python-list


To ASCII Or Not To ASCII? (Posting On Python-List Prohibited)

2017-11-15 Thread Lawrence D’Oliveiro
From :

def raıse(self) :
"raises this exception."
libm.feraiseexcept(self.mask)
#end raıse

raiise = raıse # if you prefer
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Windows - py363 crashes with "vonLöwis.py"

2017-11-15 Thread Terry Reedy

On 11/15/2017 6:58 AM, breamore...@gmail.com wrote:

On Wednesday, November 15, 2017 at 8:53:44 AM UTC, wxjm...@gmail.com wrote:

Sorry, to have to say it.

Have a nice day.


Do you mean it segfaults or simply provides a traceback?  If the latter is your 
environment set correctly?


Why bother?  Anyway, for the obvious interpretation of the message, 
given f:/python/a/vonLöwis.py containing 'print("works")'"


C:\Users\Terry>py -3.6 f:/python/a/vonLöwis.py
works

--
Terry Jan Reedy


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


MySQLdb and conn.select_db()

2017-11-15 Thread Tobiah

I have an older Ubuntu machine, 8.04 that
errors when I try to do conn.select_db().

AttributeError: 'Connection' object has no attribute 'select_db'

My 16.4 box acts as I'd expect.  Did this get added at some
point?  I'd really like to be able to get generic links so
I can do things like "show databases" and then maybe
select_db() after that.  It's also handy to be able to
change databases on the fly for things like looking at the
table set in multiple databases.

The main docs that I can find only show select_db() under the
_mysql library, yet my new machine is supporting it from
the MySQLdb library.  Are the docs lagging?  Can I download
the 'better' MySQLdb package and install it on the 8.04
machine?


Thanks,


Tobiah

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


Re: Windows - py363 crashes with "vonLöwis.py"

2017-11-15 Thread breamoreboy
On Wednesday, November 15, 2017 at 8:53:44 AM UTC, wxjm...@gmail.com wrote:
> Sorry, to have to say it.
> 
> Have a nice day.

Do you mean it segfaults or simply provides a traceback?  If the latter is your 
environment set correctly?
-- 
https://mail.python.org/mailman/listinfo/python-list


EuroPython 2018: Location and Dates

2017-11-15 Thread M.-A. Lemburg
After a two month RFP bidding process with 19 venues from all over
Europe, we are pleased to announce our selection of the location and
venue for EuroPython 2018:

* Location:
  Edinburgh, UK

* Venue:
  Edinburgh International Conference Center (EICC)
  http://www.eicc.co.uk/

* Dates:
  July 23 - 29 2018

... yes, this is just one week before the famous Edinburgh Festival
Fringe, so you can extend your stay a little longer if you like:

https://www.edfringe.com/

Based on the feedback we collected in the last few years, we have
switched to a more compact conference layout for 2018:

* Monday, Tuesday:
  Workshops and Trainings

* Wednesday, Thursday, Friday:
  Main conference with talks, keynotes, exhibition

* Saturday, Sunday:
  Sprints

More information will be available as we progress with the
organization.

PS: We are now entering contract negotiations, so the above dates are
highly likely, but we cannot confirm 100% yet.


Enjoy,
-- 
EuroPython Society
http://www.europython-society.org/


PS: Please forward or retweet to help us reach all interested parties:
https://twitter.com/europythons/status/930823621202898945
Thanks.
-- 
https://mail.python.org/mailman/listinfo/python-list


SQLObject 3.5.0

2017-11-15 Thread Oleg Broytman
Hello!

I'm pleased to announce version 3.5.0, the first stable release of branch
3.5 of SQLObject.


What's new in SQLObject
===

Contributors for this release are Shailesh Mungikar and Michael S. Root.

Minor features
--

* Add Python3 special methods for division to SQLExpression.
  Pull request by Michael S. Root.

Drivers
---

* Add support for `pg8000 `_
  PostgreSQL driver.

* Fix autoreconnect with pymysql driver. Contributed by Shailesh Mungikar.

Documentation
-

* Remove generated HTML from eggs/wheels (docs are installed into wrong
  place). Generated docs are still included in the source distribution.

Tests
-

* Add tests for PyGreSQL, py-postgresql and pg8000 at AppVeyor.

* Fixed bugs in py-postgresql at AppVeyor. SQLObject requires
  the latest version of the driver from our fork.

For a more complete list, please see the news:
http://sqlobject.org/News.html


What is SQLObject
=

SQLObject is an object-relational mapper.  Your database tables are described
as classes, and rows are instances of those classes.  SQLObject is meant to be
easy to use and quick to get started with.

SQLObject supports a number of backends: MySQL, PostgreSQL, SQLite,
Firebird, Sybase, MSSQL and MaxDB (also known as SAPDB).

Python 2.7 or 3.4+ is required.


Where is SQLObject
==

Site:
http://sqlobject.org

Development:
http://sqlobject.org/devel/

Mailing list:
https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss

Download:
https://pypi.python.org/pypi/SQLObject/3.5.0

News and changes:
http://sqlobject.org/News.html

StackOverflow:
https://stackoverflow.com/questions/tagged/sqlobject


Example
===

Create a simple class that wraps a table::

  >>> from sqlobject import *
  >>>
  >>> sqlhub.processConnection = connectionForURI('sqlite:/:memory:')
  >>>
  >>> class Person(SQLObject):
  ... fname = StringCol()
  ... mi = StringCol(length=1, default=None)
  ... lname = StringCol()
  ...
  >>> Person.createTable()

Use the object::

  >>> p = Person(fname="John", lname="Doe")
  >>> p
  
  >>> p.fname
  'John'
  >>> p.mi = 'Q'
  >>> p2 = Person.get(1)
  >>> p2
  
  >>> p is p2
  True

Queries::

  >>> p3 = Person.selectBy(lname="Doe")[0]
  >>> p3
  
  >>> pc = Person.select(Person.q.lname=="Doe").count()
  >>> pc
  1

Oleg.
-- 
 Oleg Broytmanhttp://phdru.name/p...@phdru.name
   Programmers don't die, they just GOSUB without RETURN.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: All the list getting appended of a dict if you are updating only first element list of dict

2017-11-15 Thread Peter Otten
Radhey Parashar wrote:

> I am facing 1 issue with python related to append command in a list


> class CITY:
> 
> num = 0
> 
> connectivity = []

The way you wrote it the connectivity list is shared between all instances 
of the CITY class. Consult a Python tutorial to learn why.

To get per-instance lists you have to write an initializer like the one in 
the following example:

class City:
def __init__(self, num):
self.num = num
self.connectivity = []


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


All the list getting appended of a dict if you are updating only first element list of dict

2017-11-15 Thread Radhey Parashar
Hi python ,



I am facing 1 issue with python related to append command in a list

I am attaching PDB code for more understanding:-



*I am having two classes :- *

*class CITY:*

*num = 0*

*connectivity = []*

*class CON:*

* name = 0*

* type = 0*







(Pdb) p cities

{1: <__main__.CITY instance at 0x7f9c00e03638>, 2: <__main__.CITY instance
at 0x7f9c00e03680>, 3: <__main__.CITY instance at 0x7f9c00e03950>, 4:
<__main__.CITY instance at 0x7f9c00e03998>, 5: <__main__.CITY instance at
0x7f9c00e039e0>}

(Pdb)











> /home/radhey/python/code.py(16)func()

-> list = []

(Pdb) p data

['1', '2', '3']

* (Pdb) p cities[int(data[0])].connectivity   **à Here
cities name dictionary are having city class object and each object
connectivity list is empty *

*[]*

*(Pdb) p cities[int(data[1])].connectivity*

*[]*

*(Pdb) p cities[int(data[2])].connectivity*

*[]*

(Pdb) p cities[int(data[3])].connectivity

*** IndexError: IndexError('list index out of range',)

(Pdb) n

> /home/radhey/python/code.py(17)func()

-> list = cities[int(data[0])].connectivity

(Pdb)

> /home/radhey/python/code.py(18)func()

-> list.append(con)

(Pdb)

> /home/radhey/python/code.py(19)func()

-> cities[int(data[0])].connectivity = []

(Pdb)

> /home/radhey/python/code.py(20)func()

-> *cities[int(data[0])].connectivity.extend(list)  -**à Here I
extended the connectivity list for cities[1] object *

(Pdb)

> /home/radhey/python/code.py(21)func()

-> con1 = CON

(Pdb) p cities[int(data[1])].connectivity à BUT All
the *connectivity list got updated *

[]

(Pdb) p cities[int(data[0])].connectivity

[]

(Pdb) p int(data[1])

2

(Pdb) p int(data[0])

1

(Pdb)















Code.py :-





root@OcNOS:/home/radhey/python# cat code.py





class CITY:

num = 0

connectivity = []

class CON:

name = 0

 type = 0



def func(cities):

   input = raw_input()

   con = ''

   con1 = ''

   data = input.strip().split(' ')

   con = CON

   con.name = int(data[1])

   con.type = int(data[2])

   list = []

   list = cities[int(data[0])].connectivity

   list.append(con)

   cities[int(data[0])].connectivity = []

   cities[int(data[0])].connectivity.extend(list)

   con1 = CON

   con1.name = int(data[0])

   con1.type = int(data[2])

   list = []

   list = cities[int(data[1])].connectivity

   list.append(con1)

   cities[int(data[1])].connectivity = []

   cities[int(data[1])].connectivity.extend(list)



input = raw_input()

city = int(input.split(' ')[0])

roads = int(input.split(' ')[1])

cities = {}

for c in range(1,city+1):

  city = CITY()

  city.num = c

  cities[c] = city



print city,roads

for r in range(1,roads+1):

   func(cities)



print cities









Input :-



5 7

1 2 3

2 3 3

3 4 3

5 3 2

5 4 1

5 2 2

1 5 1





Thanks

~Radhey

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