EuroPython 2020: First batch of edited videos available
We’re happy to release the first 30 cut videos of EuroPython 2020. You can watch them on our YouTube channel http://europython.tv/: * EuroPython 2020 Playlist * https://www.youtube.com/playlist?list=PL8uoeex94UhHgMD9GOCbEHWku7pEPx9fW Over the next few days/weeks, we’ll keep releasing more videos in batches. We are working on over 130 videos in total, so please stop by and check the playlist for more videos, or subscribe to our YouTube channel. Help spread the word Please help us spread this message by sharing it on your social networks as widely as possible. Thank you ! Link to the blog post: https://blog.europython.eu/post/629320931800694784/europython-2020-first-batch-of-edited-videos Tweet: https://twitter.com/europython/status/1305822961665019906 Thanks, -- EuroPython 2020 Team https://ep2020.europython.eu/ https://www.europython-society.org/ -- https://mail.python.org/mailman/listinfo/python-list
Unable to install folium using python version 3.8.4.
Team, I use python version 3.8.4. I tried to import folium using IDLE but it was unsuccessful as it throws errors. After that, I tried to use pip install folium in the command prompt but it also throws an error. Kindly advise the steps to install folium. Regards, U.Suresh. -- https://mail.python.org/mailman/listinfo/python-list
Re: Unable to install folium using python version 3.8.4.
On 2020-09-15 08:19, Suresh Unnikrishnan wrote: Team, I use python version 3.8.4. I tried to import folium using IDLE but it was unsuccessful as it throws errors. After that, I tried to use pip install folium in the command prompt but it also throws an error. Kindly advise the steps to install folium. What were the errors? Which OS are you using? You need to provide details. -- https://mail.python.org/mailman/listinfo/python-list
python mariadb & html tables
I'm trying to create an table in html from a Maria DB table, from a python
script. I'm getting some unexpected results.
The environment is Centos 7, I'm using Python3 with apache.
Here is copy of the script I'm using:
*** SCRIPT START *
import mysql.connector
import cgitb
cgitb.enable()
mydb = mysql.connector.connect(
host="localhost",
user="root",
password="somepassword",
database="somedb"
)
mycursor = mydb.cursor()
mycursor.execute("select name, provisioned_space, used_space, memory_size,
cpus, ip_address, host_cpu, host_mem from projecttable where name like
'%newproject%'")
myresult = mycursor.fetchall()
print "Content-type: text/plain:charset=utf-8"
print
for x in myresult:
print(x)
*** SCRIPT STOPS *
It works. But I get alot of extraneous data I don't need or want. Here is an
example of the output:
* OUTPUT STARTS ***
Content-type: text/plain:charset=utf-8
(u'host1.mydomain.com', u'106.11 GB', u'32.72 GB', u'1 GB', u'1',
u'172.18.33.62', u'Running', u'16 MHz')
(u'hopst2.mydomain.com', u'106.08 GB', u'56.87 GB', u'1 GB', u'1',
u'172.17.4.82', u'Running', u'0 Hz')
* OUTPUT STOPS ***
Is this typical of Python? Do I need create another script to clean up the
output? Or is there a better way to extract data from a MariaDB instance, and
put it in an HTML table? Any advise would be appreciated.
TIA
--
https://mail.python.org/mailman/listinfo/python-list
Re: python mariadb & html tables
On Tue, Sep 15, 2020 at 11:45 AM SS wrote:
>
> I'm trying to create an table in html from a Maria DB table, from a python
> script. I'm getting some unexpected results.
>
> The environment is Centos 7, I'm using Python3 with apache.
>
> Here is copy of the script I'm using:
>
> *** SCRIPT START *
>
> import mysql.connector
> import cgitb
> cgitb.enable()
>
> mydb = mysql.connector.connect(
> host="localhost",
> user="root",
> password="somepassword",
> database="somedb"
> )
>
> mycursor = mydb.cursor()
>
> mycursor.execute("select name, provisioned_space, used_space, memory_size,
> cpus, ip_address, host_cpu, host_mem from projecttable where name like
> '%newproject%'")
>
> myresult = mycursor.fetchall()
>
> print "Content-type: text/plain:charset=utf-8"
> print
> for x in myresult:
> print(x)
>
>
> *** SCRIPT STOPS *
>
> It works. But I get alot of extraneous data I don't need or want. Here is
> an example of the output:
>
> * OUTPUT STARTS ***
>
> Content-type: text/plain:charset=utf-8
>
> (u'host1.mydomain.com', u'106.11 GB', u'32.72 GB', u'1 GB', u'1',
> u'172.18.33.62', u'Running', u'16 MHz')
> (u'hopst2.mydomain.com', u'106.08 GB', u'56.87 GB', u'1 GB', u'1',
> u'172.17.4.82', u'Running', u'0 Hz')
>
> * OUTPUT STOPS ***
>
> Is this typical of Python? Do I need create another script to clean up the
> output? Or is there a better way to extract data from a MariaDB instance,
> and put it in an HTML table? Any advise would be appreciated.
What is the extraneous data?
--
https://mail.python.org/mailman/listinfo/python-list
Re: python mariadb & html tables
On Tuesday, September 15, 2020 at 2:52:35 PM UTC-4, [email protected] wrote: > On Tue, Sep 15, 2020 at 11:45 AM SS wrote: > > > > I'm trying to create an table in html from a Maria DB table, from a python > > script. I'm getting some unexpected results. > > > > The environment is Centos 7, I'm using Python3 with apache. > > > > Here is copy of the script I'm using: > > > > *** SCRIPT START * > > > > import mysql.connector > > import cgitb > > cgitb.enable() > > > > mydb = mysql.connector.connect( > > host="localhost", > > user="root", > > password="somepassword", > > database="somedb" > > ) > > > > mycursor = mydb.cursor() > > > > mycursor.execute("select name, provisioned_space, used_space, memory_size, > > cpus, ip_address, host_cpu, host_mem from projecttable where name like > > '%newproject%'") > > > > myresult = mycursor.fetchall() > > > > print "Content-type: text/plain:charset=utf-8" > > print > > for x in myresult: > > print(x) > > > > > > *** SCRIPT STOPS * > > > > It works. But I get alot of extraneous data I don't need or want. Here is > > an example of the output: > > > > * OUTPUT STARTS *** > > > > Content-type: text/plain:charset=utf-8 > > > > (u'host1.mydomain.com', u'106.11 GB', u'32.72 GB', u'1 GB', u'1', > > u'172.18.33.62', u'Running', u'16 MHz') > > (u'hopst2.mydomain.com', u'106.08 GB', u'56.87 GB', u'1 GB', u'1', > > u'172.17.4.82', u'Running', u'0 Hz') > > > > * OUTPUT STOPS *** > > > > Is this typical of Python? Do I need create another script to clean up the > > output? Or is there a better way to extract data from a MariaDB instance, > > and put it in an HTML table? Any advise would be appreciated. > What is the extraneous data? Thanks for responding. I am expecting (or would like) to get the following output: Content-type: text/plain:charset=utf-8 host1.mydomain.com 106.11 GB32.72 GB 1 GB172.18.33.62 Running 16 MHz host2.mydomain.com106.08 GB 56.87 GB 1 GB 1 GB 172.17.4.82Running 0 Hz But instead I get the following: Content-type: text/plain:charset=utf-8 (u'host1.mydomain.com', u'106.11 GB', u'32.72 GB', u'1 GB', u'1', u'172.18.33.62', u'Running', u'16 MHz') (u'hopst2.mydomain.com', u'106.08 GB', u'56.87 GB', u'1 GB', u'1', u'172.17.4.82', u'Running', u'0 Hz') So each table row is enclosed in parenthesis, and each field is enclosed in 'u ', Ultimately, my intention is to create an html table, from a Maria DB table using Python. TIA. -- https://mail.python.org/mailman/listinfo/python-list
Re: python mariadb & html tables
On 2020-09-15 19:41, SS wrote:
I'm trying to create an table in html from a Maria DB table, from a python
script. I'm getting some unexpected results.
The environment is Centos 7, I'm using Python3 with apache.
Here is copy of the script I'm using:
*** SCRIPT START *
import mysql.connector
import cgitb
cgitb.enable()
mydb = mysql.connector.connect(
host="localhost",
user="root",
password="somepassword",
database="somedb"
)
mycursor = mydb.cursor()
mycursor.execute("select name, provisioned_space, used_space, memory_size, cpus,
ip_address, host_cpu, host_mem from projecttable where name like '%newproject%'")
myresult = mycursor.fetchall()
print "Content-type: text/plain:charset=utf-8"
print
for x in myresult:
print(x)
*** SCRIPT STOPS *
It works. But I get alot of extraneous data I don't need or want. Here is an
example of the output:
* OUTPUT STARTS ***
Content-type: text/plain:charset=utf-8
(u'host1.mydomain.com', u'106.11 GB', u'32.72 GB', u'1 GB', u'1',
u'172.18.33.62', u'Running', u'16 MHz')
(u'hopst2.mydomain.com', u'106.08 GB', u'56.87 GB', u'1 GB', u'1',
u'172.17.4.82', u'Running', u'0 Hz')
* OUTPUT STOPS ***
Is this typical of Python? Do I need create another script to clean up the
output? Or is there a better way to extract data from a MariaDB instance, and
put it in an HTML table? Any advise would be appreciated.
That's not Python 3, that's Python 2.
The u'host1.mydomain.com' is a Unicode string. If you're going to print
it in Python 2, you'll need to encode it to bytes, UTF-8 in this case.
--
https://mail.python.org/mailman/listinfo/python-list
Re: python mariadb & html tables
On 2020-09-15 20:33, SS wrote: On Tuesday, September 15, 2020 at 2:52:35 PM UTC-4, [email protected] wrote: On Tue, Sep 15, 2020 at 11:45 AM SS wrote: > > I'm trying to create an table in html from a Maria DB table, from a python script. I'm getting some unexpected results. > > The environment is Centos 7, I'm using Python3 with apache. > > Here is copy of the script I'm using: > > *** SCRIPT START * > > import mysql.connector > import cgitb > cgitb.enable() > > mydb = mysql.connector.connect( > host="localhost", > user="root", > password="somepassword", > database="somedb" > ) > > mycursor = mydb.cursor() > > mycursor.execute("select name, provisioned_space, used_space, memory_size, cpus, ip_address, host_cpu, host_mem from projecttable where name like '%newproject%'") > > myresult = mycursor.fetchall() > > print "Content-type: text/plain:charset=utf-8" > print > for x in myresult: > print(x) > > > *** SCRIPT STOPS * > > It works. But I get alot of extraneous data I don't need or want. Here is an example of the output: > > * OUTPUT STARTS *** > > Content-type: text/plain:charset=utf-8 > > (u'host1.mydomain.com', u'106.11 GB', u'32.72 GB', u'1 GB', u'1', u'172.18.33.62', u'Running', u'16 MHz') > (u'hopst2.mydomain.com', u'106.08 GB', u'56.87 GB', u'1 GB', u'1', u'172.17.4.82', u'Running', u'0 Hz') > > * OUTPUT STOPS *** > > Is this typical of Python? Do I need create another script to clean up the output? Or is there a better way to extract data from a MariaDB instance, and put it in an HTML table? Any advise would be appreciated. What is the extraneous data? Thanks for responding. I am expecting (or would like) to get the following output: Content-type: text/plain:charset=utf-8 host1.mydomain.com 106.11 GB32.72 GB1 GB172.18.33.62 Running 16 MHz host2.mydomain.com106.08 GB 56.87 GB 1 GB 1 GB 172.17.4.82Running 0 Hz But instead I get the following: Content-type: text/plain:charset=utf-8 (u'host1.mydomain.com', u'106.11 GB', u'32.72 GB', u'1 GB', u'1', u'172.18.33.62', u'Running', u'16 MHz') (u'hopst2.mydomain.com', u'106.08 GB', u'56.87 GB', u'1 GB', u'1', u'172.17.4.82', u'Running', u'0 Hz') So each table row is enclosed in parenthesis, and each field is enclosed in 'u ', Ultimately, my intention is to create an html table, from a Maria DB table using Python. TIA. Each row (from myresult) is a tuple of Unicode strings. You're asking Python to print them, which is what it's doing. If you want a table in HTML, you'll need to write the code to do that. -- https://mail.python.org/mailman/listinfo/python-list
Re: python mariadb & html tables
On Tuesday, September 15, 2020 at 2:52:35 PM UTC-4, [email protected] wrote: > On Tue, Sep 15, 2020 at 11:45 AM SS wrote: > > > > I'm trying to create an table in html from a Maria DB table, from a python > > script. I'm getting some unexpected results. > > > > The environment is Centos 7, I'm using Python3 with apache. > > > > Here is copy of the script I'm using: > > > > *** SCRIPT START * > > > > import mysql.connector > > import cgitb > > cgitb.enable() > > > > mydb = mysql.connector.connect( > > host="localhost", > > user="root", > > password="somepassword", > > database="somedb" > > ) > > > > mycursor = mydb.cursor() > > > > mycursor.execute("select name, provisioned_space, used_space, memory_size, > > cpus, ip_address, host_cpu, host_mem from projecttable where name like > > '%newproject%'") > > > > myresult = mycursor.fetchall() > > > > print "Content-type: text/plain:charset=utf-8" > > print > > for x in myresult: > > print(x) > > > > > > *** SCRIPT STOPS * > > > > It works. But I get alot of extraneous data I don't need or want. Here is > > an example of the output: > > > > * OUTPUT STARTS *** > > > > Content-type: text/plain:charset=utf-8 > > > > (u'host1.mydomain.com', u'106.11 GB', u'32.72 GB', u'1 GB', u'1', > > u'172.18.33.62', u'Running', u'16 MHz') > > (u'hopst2.mydomain.com', u'106.08 GB', u'56.87 GB', u'1 GB', u'1', > > u'172.17.4.82', u'Running', u'0 Hz') > > > > * OUTPUT STOPS *** > > > > Is this typical of Python? Do I need create another script to clean up the > > output? Or is there a better way to extract data from a MariaDB instance, > > and put it in an HTML table? Any advise would be appreciated. > What is the extraneous data? The extraneous data is: (u'host1.mydomain.com', u'106.11 GB', u'32.72 GB', u'1 GB', u'1', u'172.18.33.62', u'Running', u'16 MHz') It is all the u characters, the single quotes, and the parenthesis. Ultimately, I would like to create an html table in an html page, from a a MariaDB table. Thanks, -- https://mail.python.org/mailman/listinfo/python-list
Re: python mariadb & html tables
On Tue, Sep 15, 2020 at 1:35 PM SS wrote: > > On Tuesday, September 15, 2020 at 2:52:35 PM UTC-4, [email protected] > wrote: > > On Tue, Sep 15, 2020 at 11:45 AM SS wrote: > > > > > > I'm trying to create an table in html from a Maria DB table, from a > > > python script. I'm getting some unexpected results. > > > > > > The environment is Centos 7, I'm using Python3 with apache. > > > > > > Here is copy of the script I'm using: > > > > > > *** SCRIPT START * > > > > > > import mysql.connector > > > import cgitb > > > cgitb.enable() > > > > > > mydb = mysql.connector.connect( > > > host="localhost", > > > user="root", > > > password="somepassword", > > > database="somedb" > > > ) > > > > > > mycursor = mydb.cursor() > > > > > > mycursor.execute("select name, provisioned_space, used_space, > > > memory_size, cpus, ip_address, host_cpu, host_mem from projecttable where > > > name like '%newproject%'") > > > > > > myresult = mycursor.fetchall() > > > > > > print "Content-type: text/plain:charset=utf-8" > > > print > > > for x in myresult: > > > print(x) > > > > > > > > > *** SCRIPT STOPS * > > > > > > It works. But I get alot of extraneous data I don't need or want. Here is > > > an example of the output: > > > > > > * OUTPUT STARTS *** > > > > > > Content-type: text/plain:charset=utf-8 > > > > > > (u'host1.mydomain.com', u'106.11 GB', u'32.72 GB', u'1 GB', u'1', > > > u'172.18.33.62', u'Running', u'16 MHz') > > > (u'hopst2.mydomain.com', u'106.08 GB', u'56.87 GB', u'1 GB', u'1', > > > u'172.17.4.82', u'Running', u'0 Hz') > > > > > > * OUTPUT STOPS *** > > > > > > Is this typical of Python? Do I need create another script to clean up > > > the output? Or is there a better way to extract data from a MariaDB > > > instance, and put it in an HTML table? Any advise would be appreciated. > > What is the extraneous data? > > The extraneous data is: > > (u'host1.mydomain.com', u'106.11 GB', u'32.72 GB', u'1 GB', u'1', > u'172.18.33.62', u'Running', u'16 MHz') > > It is all the u characters, the single quotes, and the parenthesis. > Ultimately, I would like to create an html table in an html page, from a a > MariaDB table. That is how the data is printed - those things are not part of the data. To generate HTML you will have to iterate over the result set and create the needed markup. E.g.: html = "" for row in myresult: html += "" for item in row: html += "%s" % item html += "" html += "" -- https://mail.python.org/mailman/listinfo/python-list
