Support SSL for Solaris 10

2007-04-05 Thread campos
Hi all,

Last time I installed Python 2.5 by default, it didn't support SSL.
When I tried to use HTTPS, the following error occured:
AttributeError: 'module' object has no attribute 'ssl'

In README file:
--
   (a) the band-aid fix is to link the _socket module statically
   rather than dynamically (which is the default).

   To do this, run "./configure --with-threads=no" including any
   other options you need (--prefix, etc.).  Then in Modules/Setup
   uncomment the lines:

   #SSL=/usr/local/ssl
   #_socket socketmodule.c \
   #   -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
   #   -L$(SSL)/lib -lssl -lcrypto

   and remove "local/" from the SSL variable.  Finally, just run
   "make"!
--

I followed these steps. However I am puzzled with:
"remove "local/" from the SSL variable"

I tried several cases such as "/usr/ssl", "~/local/ssl", "/usr/local/
ssl"
All failed in building ssl module.

How to solve it?
Thanks in advance!

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


Conecting to MySQL

2022-08-09 Thread Guilherme Campos
Hello folks,

trying to connect to MYSQL it appears the error msg below:
InterfaceError: 2003: Can't connect to MySQL server on 'localhost:3306'
(111 Connection refused)
[image: conexao.png]
How can i fix that.?

thanks in advance

Guilherme Campos
Belo Horizonte - MG
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Conecting to MySQL

2022-08-09 Thread Guilherme Campos
Igor,

firewall was disable...

Em ter., 9 de ago. de 2022 às 11:18, Igor Korot 
escreveu:

> Hi,
>
> On Tue, Aug 9, 2022 at 9:07 AM Guilherme Campos
>  wrote:
> >
> > Hello folks,
> >
> > trying to connect to MYSQL it appears the error msg below:
> > InterfaceError: 2003: Can't connect to MySQL server on 'localhost:3306'
> > (111 Connection refused)
> > [image: conexao.png]
> > How can i fix that.?
>
> What do you use for connection?
> Does the firewall interfere with the connection?
>
> Thank you.
>
> >
> > thanks in advance
> >
> > Guilherme Campos
> > Belo Horizonte - MG
> > --
> > https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Conecting to MySQL

2022-08-09 Thread Guilherme Campos
Hi Igor,

Accessing mysql-workbench it appeared new error messages when I clicked
Server Status.

I created my database on MySQL Workbench . Is that your question?


[image: image.png]

[image: image.png]


Em ter., 9 de ago. de 2022 às 12:36, Igor Korot 
escreveu:

> Hi,
> @OP,
> Can you try to connect with mysql-workbench?
> Also - you didn't answer my first question.
>
> Are you using an ODBC wrapper or python module?
>
> Thank you.
>
>
> On Tue, Aug 9, 2022 at 10:27 AM Axy  wrote:
> >
> >
> > >> trying to connect to MYSQL it appears the error msg below:
> > >> InterfaceError: 2003: Can't connect to MySQL server on
> 'localhost:3306'
> > >> (111 Connection refused)
> > >> [image: conexao.png]
> > >> How can i fix that.?
> > > What do you use for connection?
> > > Does the firewall interfere with the connection?
> >
> > Firewall usually causes connection to hang and timeout with no response.
> >
> > But in this case connection looks immediately refused which means either
> > port number is wrong or mysql is not listening on 127.0.0.1.
> >
> >
> > Axy
> >
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Extract UTFGrid from MBTiles database

2013-06-03 Thread Carmen Campos Bordons
I would appreciate any help or comment.
The idea is
to create a server in python that serves maps on the internet. The maps have to
be in MBTiles format, which is a SQLite database that store all the map tiles
in a single file. Taking this as an example 
http://a.tiles.mapbox.com/v3/mapbox.geography-class/page.html#4.00/36.74/28.30 
The tiles are images of the
map in png, like this one 
http://a.tiles.mapbox.com/v3/mapbox.geography-class/4/7/7.png and apart from 
the tiles, in the
database is stored the UTFGrid information, like this file 
http://a.tiles.mapbox.com/v3/mapbox.geography-class/4/7/7.grid.json. The 
UTFGrid (you can consult in http://www.mapbox.com/developers/utfgrid/) permits 
than when you hover in the
map, some extra information appears referring to the point where the mouse is.
As you can see in this example 
http://a.tiles.mapbox.com/v3/mapbox.geography-class/page.html#4.00/36.74/28.30 
a infobox appears with the
flag of every country(which is the information stored in the UTFGrid file).

In the
MBTiles database there are two table (also other, but not important in this 
case):
“tiles”, where are stored the tiles; and “grids”, where is stored the UTFGrid
associated to every tile.

>From the
MBTiles I can extract the tiles and display a normal map, and I can also
extract the UTFGrid file individually (not all together, like the tiles that I
can see the whole map; with the UTFGrid I just get one file). When I show the
map normally, the infoboxes do not appear. But I do not get any error in
command line or in the website. It just like the UTFGrid is empty.

Attached is
the code I am using to access the MBtiles file.

I am using
this SQL to access the MBTiles file

“select
grid from grids where tile_column=? and tile_row=? and zoom_level=?", (x,
y, z)

And if I
change it for this

"select
grid from grids where tile_column=? and tile_row=? and zoom_level=?", (67,
84, 7)

I am
getting always the same UTFGrid, but in this case it shows the infoboxes on the
map, that one for all the tiles.

It is like
if I have this part of the map 
http://a.tiles.mapbox.com/v3/mapbox.geography-class/page.html#4.00/10.14/17.31 
but I always get the
infoboxes of this tile 
http://a.tiles.mapbox.com/v3/mapbox.geography-class/4/7/7.png I get the 
infoboxes in all the
tiles, but all of them are showing the flag of that tile.
Thanks,Carmen 
import sqlite3
import json
import zlib

def get_tile(layer, x, y, z, ext):
	try:
		# Connect to the database and get the cursor
		db = sqlite3.connect("data/%s.mbtiles" % layer)
		c = db.cursor()
		#closing(db.cursor)
	except:
		# return None
		# In case the connection can not be done
		start_response('404 Not found', [('Content-Type', 'text/plain')])
		return ["Not found: %s.mbtiles" % (layer,)]
	# Get the tiles from the database, using the zoom and the coordinates we got previously
	c.execute("select tile_data from tiles where tile_column=? and tile_row=? and zoom_level=?", (x, y, z))
	res = c.fetchone()
	if res:
		# In case there are tiles, print them with their necesary headers
		get_grid(layer, x, y, z)
		return bytes(res[0])
	return None


def get_grid(layer, x, y, z): #, ext):
	print "accede a grid"
# Connect to the database and get the cursor
	try:
		db = sqlite3.connect("data/%s.mbtiles" % layer)
		c1 = db.cursor()
		c2 = db.cursor()
		#closing(db.cursor)
	except:
		# In case the connection can not be done
		start_response('404 Not found', [('Content-Type', 'text/plain')])
		return ["Not found: %s.mbtiles" % (layer,)]
	# Get the utfgrid info from the database, using the zoom and the coordinates we got previously
	c1.execute("select grid from grids where tile_column=? and tile_row=? and zoom_level=?", (67, 84, 7)) #(31, 39, 6)) #
	#c1.execute("select * from grids")
	row = c1.fetchone()
	if not row:
		print "NO ROW"
		return None
	print "ROW"
	bts = bytes(row[0])
	# Decompresses the data in string, returning a string containing the uncompressed data.
	files = zlib.decompress(bts)
	# Deserialize files to a Python object -> http://docs.python.org/2/library/json.html#json-to-py-table
	jsonfiles = json.loads(files)
	#return jsonfiles

	# Get the data
	keys = []
	#for keyrow in c2.execute("select key_name as key, key_json as json from grid_data where zoom_level=? and tile_column=? and tile_row=?", (z, x, y)):
	for keyrow in c2.execute("SELECT keymap.key_name AS key_name, keymap.key_json AS key_json FROM map JOIN grid_utfgrid ON grid_utfgrid.grid_id = map.grid_id JOIN grid_key ON grid_key.grid_id = map.grid_id JOIN keymap ON grid_key.key_name = keymap.key_name WHERE tile_column=? and tile_row=? and zoom_level=?", (67, 84, 7)): #(31, 39, 6)): #(x, y, z)):
		keyname, keydata = keyrow  
		keys.append((keyname, eval(keydata))) 
	datadict = dict(keys)
	jsonfiles[u'data'] = datadict
	# return jsonfiles
	print "okey Z:" + z + "x,y" + x + y
	# Serialize jsonfiles to a JSON formatted string using -> http://docs.python.org/2/library/json.html#py-to-js