fopen() and open() in cpython

2019-08-13 Thread Windson Yang
After my investigation, I found Since Python maintains its own buffer when
read/write files, the build-in python open() function will call the open()
system call instead of calling standard io fopen() for caching.  So when we
read/write a file in Python, it would not call fopen(), fopen() only use
for Python itself but not for python user. Am I correct?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: MySQLdb for 3.6 on RHEL7

2019-08-13 Thread Inada Naoki
On Wed, Aug 14, 2019 at 4:10 AM Larry Martell  wrote:
>
> > > And I was not able to get that from pip either,
> > > as the install failed. I had to download the source, edit the site.cfg
> > > file and build it. But I just found python36-mysql.x86_64 as a package
> > > so I uninstalled mysqlclient and installed that from the repo.
>
> The reason that would not install from pip was because the path to
> mysql_config was not correct in site.cfg - once I changed that I was
> able to build it, but then it gave the other error.
>

It's wrong.  The path to mysql_config is not defined in site.cfg by default.
There is example configuration but it's commented out.
By default mysqlclient searches mysql_config from PATH.

You had not reported enough information from start.  You should explain which
C mysql client library you are using and how you build mysqlclient.

Since you said you need to specify the path of mysql_config, I suppose
you're not using MySQL or C mysql client library provided by your distro.
But you have not show enough information about it yet.

This is linking error.  The error is happened from C library.  You need to
report about it, at least:

* How did you installed C mysql client library.
* The output of the `mysql_config`
* The output of the `ldd
/usr/local/lib64/python3.6/site-packages/mysqlclient-1.4.4-py3.6-linux-x86_64.egg/MySQLdb/_mysql.cpython-36m-x86_64-linux-gnu.so`

Regards,
-- 
Inada Naoki  
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Opening Python 3.8 in Visual Studio 2019

2019-08-13 Thread MRAB

On 2019-08-13 20:31, Moe Vyas wrote:

Greetings.
Can anyone please, tell me how to open Python 3.8 Interpreter in the Visual
Studio 2019. I have downloaded both of these on my Windows laptop and now
am struggling to make them work together!!?


Have a read here:

https://docs.microsoft.com/en-us/visualstudio/python/tutorial-working-with-python-in-visual-studio-step-01-create-project?view=vs-2019
--
https://mail.python.org/mailman/listinfo/python-list


Re: Create multiple sqlite tables, many-to-many design

2019-08-13 Thread Rich Shepard

On Wed, 14 Aug 2019, MRAB wrote:


The actual code is different. htbl, ttbl, jtbl, etc. Too short?


Definitely! :-)

Another thing you might want to avoid is naming something with what it is, 
e.g. "Trails_Table" (why not just "Trails").


Another reason to read Celko's 'SQL Programming Style.'

In the 1970s I was writing FORTRAN ecosystem models punched on 80-column
Hollerith cards using an IBM 029 keypunch. Everything was as short as
possible, especially variable names. There were two valuable lessons I
learned (in addition to marking a Sharpie pen line diagonally across the
card deck to make it easier to put back in sequence when the box was
dropped):

1. Make variable names fully descriptive.

2. Write many comments to explain what things are and why you're doing
things the way you are.

The reason is that within 6 months (or less) you will look at your schema
and code and have no idea what's going on or why you wrote it like that.

Table names are commonly written with initial uppercase letters; variables
in all lowercase. Leave CamelCase in the desert. Use underscores between
words, e.g., hike_id, trail_nbr, not hyphens.

And, you might not be the only person looking at the schema and code needing
to understand what's going on.

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


Re: Create multiple sqlite tables, many-to-many design

2019-08-13 Thread MRAB

On 2019-08-13 22:11, Dave via Python-list wrote:

On 8/13/19 4:45 PM, MRAB wrote:

On 2019-08-13 19:59, Chris Angelico wrote:

On Wed, Aug 14, 2019 at 4:50 AM Dave via Python-list
 wrote:

Some of the tables are related.  For example:

Hiking_Table Trails_Table    Joining_Table
-        -
hike_id PK   trail_id  PK    hike_id   FK
hike_date  TEXT  trail_name  TEXT    trail_id   FK
hike_destination TEXT    trail_rating REAL
hike_rating  REAL    trail_comments TEXT
hike_comments  TEXT


[snip]
Might I also suggest dropping unnecessary prefixes from the field names. 
For example, "hike_comments" in "Hiking_Table" can be called just 
"comments" because it's clear from the context that a field called 
"comments" in the hiking table will contain comments about hiking, if 
you see what I mean.


I do indeed.  I did that so it was easy for everyone to follow.  Having
started with assm. and C, I have to remind myself to be more explanatory
in naming.  Guess I over-did it.  The actual code is different. htbl,
ttbl, jtbl, etc.  Too short?


Definitely! :-)

Another thing you might want to avoid is naming something with what it 
is, e.g. "Trails_Table" (why not just "Trails").

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


Re: Web framework for static pages

2019-08-13 Thread Morten W. Petersen
Hi "DL Neil".

I find your argumentation combative and provoking.

I have an ex that has made my life difficult for the last 6 years, blocking
me from seeing my kids, she acts in a similar way.

I don't have the time, energy or the will to bring more of that stuff into
my life, so I won't reply to this type of email.

-Morten

Blogging at http://blogologue.com
Tweeting at https://twitter.com/blogologue
On Instagram https://instagram.com/morphexx

ons. 14. aug. 2019, 01.27 skrev DL Neil :

> On 13/08/19 10:54 PM, Morten W. Petersen wrote:
> > I was hoping to avoid testing a lot of different systems, spending time
> > there.
>
> Sooner or later you have to make a decision - and be responsible for it
> to your clients.
>
>
> > So that's why I'm asking here.
>
> People here are helpful. The more time you put-in, the more inclined
> folk are to help further.
>
>
> > I don't need a guide to create a website, maybe a refresher on some
> topics.
>
> Respectfully, and knowing only the little posted here, this seems an
> under-statement, eg you don't appear know how HTML5 succeeds and exceeds
> XHTML (and has done so for many years). Do you under-estimate how much
> things have developed during the last decade?
>
>
> > Ideally I'd want a static site generator that makes it easy and quick to
> > create a website which is pretty, accessible, works across browsers and
> > standards compliant and doesn't freeze the browser on a low-end phone.
>
> In, XHTML???
>
> This stuff is not straight-forward. Neither is it Python/a topic for
> this list.
>
> Whilst I place myself in the 'master' category for HTML5 development and
> cheerfully regard manually knocking-out the likes of an "About Us"
> static page using nothing more than a basic editor as "quick and easy",
> there is no room for such 'purity' and idealism when phones and
> 'responsive' elements enter the picture. "Here be dragons"!
>
> I'm wary of claiming such a skill-level in Python - particularly given
> its incredibly wide range of application. That side of the process can
> be simple or complex - you choose.
>
> [this further to comment after next para]
> "Flask" has been mentioned, and over many years Mig has contributed
> numbers of tutorials, videos, articles, and books; which IMHO make it
> easy to understand that package - and most others (in this category). As
> such, I recommend it as a great starting-point, even if that learning
> better-equips you to change to something else later!
> (see also mention in other contributions to this thread)
>
>
> > And where it is easy to override using for example plain or template
> > HTML, or extend programmatic features using some plugins or just
> > subclassing.
>
> Using Python as an 'engine' to generate a web-site, either as a static
> file-set or as part of a web server is relatively trivial. Some of your
> more detailed specs will likely lead you down one or another path. What
> inspiration did you get from reading-up about Flask? Pelican? Other
> suggestions made 'here'? In what way did they not meet the mark?
>
>
> > Do you know of a XML DTD for HTML5 by the way?
>
> See above.
> (How is a web page declared to be HTML5, cf any other format? How does
> one ensure that a web page is 'HTML5-compliant'? How does/can one do
> "pretty" in (X)HTML?)
> --
> Regards =dn
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: MySQLdb for 3.6 on RHEL7

2019-08-13 Thread Chris Angelico
On Wed, Aug 14, 2019 at 9:27 AM DL Neil  wrote:
>
> On 14/08/19 6:14 AM, Chris Angelico wrote:
> > That seems very odd. The mysqlclient binary might be just under a
> > different name? I'm not familiar with RHEL, but on my Debian, there
> > are packages like "mysql-server-5.7" and corresponding
> > "mysql-client-5.7". Or do you mean the Python client?
>
> Just in case: please be aware that the MySQL-client which enables a
> cmdLN interface to the server, is quite different from the
> Python-Connector which will be called from Python code.

Hmm. Where would the C libraries be? I would have thought
"mysql-client" included the necessary binary library for the Python
MySQL .so to link against.

It's been ages since I dug into any of the details of MySQL setup. I
moved completely to PostgreSQL years ago and haven't looked back.

> As Chris has said, there are combinations of clients and servers, many
> of which are incompatible. Like him, I've stuck with MySQL v5 by reason
> of exactly this sort of inter-dependence (MySQL-Workbench? - admittedly
> a decision made, I estimate, over one year ago) - whereas MySQL
> Community will 'favor' v8.n!

Actually I've "stuck" with version 5 simply because it's currently
installed here and I haven't seen fit to uninstall it. Which probably
means that Debian's repositories are still shipping a 5.x. But on
analysis, this is turning out to be actually MariaDB... no idea
whether that's significant or not.

> Recommend:
> - clear-out 'everything' MySQL-related
> - install the MySQL (Community) site's repo (v5 or v8, as you see fit)
> - using rpm/yum/dnf, assemble your tool-set directly from them
> (single-source!)
> - test using the MySQL cmdLN client
> - only thereafter move to testing the Python/Django connection.

That sounds like a good plan.

> I have no problems with/complaints about MySQL's Python-Connector (and
> usually stick to the simpler interface/API).
>
> Various alternative interfaces (to MySQL's) seem quite similar, and
> often require identical code/function calls from within Python...
>
> I can't speak to the Django-MySQL interface.
>
> When the time comes, your client can shell-out for MySQL support, and
> build (essentially) the same environment for the 'live env', from those
> repos!

Another thing to consider is additional middleware like SQLAlchemy,
which may make things easier, but may just add more complications.

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


Re: MySQLdb for 3.6 on RHEL7

2019-08-13 Thread DL Neil

On 14/08/19 6:14 AM, Chris Angelico wrote:

On Wed, Aug 14, 2019 at 1:48 AM Larry Martell  wrote:


On Tue, Aug 13, 2019 at 9:59 AM Chris Angelico  wrote:


On Tue, Aug 13, 2019 at 11:33 PM Larry Martell  wrote:


I am trying to install MySQLdb (https://pypi.org/project/mysqlclient/)
for python3.6 on RHEL7.
When I import it, it fails:

...


Has anyone seen and resolved this?


Not specifically, but that looks like a versioning conflict. Most
likely, your mysqlclient is too old for MySQLdb to connect to.


+1



Did you get one of them from your system package manager and the other
from pip? If so, try to get both from the same place.


So I have MySQL from the system package manager, but mysqlclient is
not available there.


By which you mean RedHat's repository?



That seems very odd. The mysqlclient binary might be just under a
different name? I'm not familiar with RHEL, but on my Debian, there
are packages like "mysql-server-5.7" and corresponding
"mysql-client-5.7". Or do you mean the Python client?


Just in case: please be aware that the MySQL-client which enables a 
cmdLN interface to the server, is quite different from the 
Python-Connector which will be called from Python code.




And I was not able to get that from pip either,
as the install failed. I had to download the source, edit the site.cfg
file and build it. But I just found python36-mysql.x86_64 as a package
so I uninstalled mysqlclient and installed that from the repo.


Based on this, I'm thinking possibly you meant the Python client. It
may still be that you need to install the C client for the Python one
to connect to. Although if you got python36-mysql from your system
repo, that ought to drag in the appropriate mysqlclient. So now I'm
very confused.


+1



That did not get the above error, but now I get this:
 raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is
required; you have %s.' % Database.__version__)
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or
newer is required; you have 1.3.12.


This claims to be a Django error, though, so maybe the issue here
isn't with MySQLdb but with Django?? Maybe everything up above is
actually correctly matched, but too old?


I often develop on CentOS/Fedora* whereas the client has paid-for RedHat 
support. To keep the two environments in-sync, I always use the MySQL 
(Community) repo(s).
* which is yet another 'battle' because "MariaDB" may be installed 
by-default, in preference to MySQL)


As Chris has said, there are combinations of clients and servers, many 
of which are incompatible. Like him, I've stuck with MySQL v5 by reason 
of exactly this sort of inter-dependence (MySQL-Workbench? - admittedly 
a decision made, I estimate, over one year ago) - whereas MySQL 
Community will 'favor' v8.n!


Recommend:
- clear-out 'everything' MySQL-related
- install the MySQL (Community) site's repo (v5 or v8, as you see fit)
- using rpm/yum/dnf, assemble your tool-set directly from them 
(single-source!)

- test using the MySQL cmdLN client
- only thereafter move to testing the Python/Django connection.

I have no problems with/complaints about MySQL's Python-Connector (and 
usually stick to the simpler interface/API).


Various alternative interfaces (to MySQL's) seem quite similar, and 
often require identical code/function calls from within Python...


I can't speak to the Django-MySQL interface.

When the time comes, your client can shell-out for MySQL support, and 
build (essentially) the same environment for the 'live env', from those 
repos!


--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: Web framework for static pages

2019-08-13 Thread DL Neil

On 13/08/19 10:54 PM, Morten W. Petersen wrote:
I was hoping to avoid testing a lot of different systems, spending time 
there.


Sooner or later you have to make a decision - and be responsible for it 
to your clients.




So that's why I'm asking here.


People here are helpful. The more time you put-in, the more inclined 
folk are to help further.




I don't need a guide to create a website, maybe a refresher on some topics.


Respectfully, and knowing only the little posted here, this seems an 
under-statement, eg you don't appear know how HTML5 succeeds and exceeds 
XHTML (and has done so for many years). Do you under-estimate how much 
things have developed during the last decade?



Ideally I'd want a static site generator that makes it easy and quick to 
create a website which is pretty, accessible, works across browsers and 
standards compliant and doesn't freeze the browser on a low-end phone.


In, XHTML???

This stuff is not straight-forward. Neither is it Python/a topic for 
this list.


Whilst I place myself in the 'master' category for HTML5 development and 
cheerfully regard manually knocking-out the likes of an "About Us" 
static page using nothing more than a basic editor as "quick and easy", 
there is no room for such 'purity' and idealism when phones and 
'responsive' elements enter the picture. "Here be dragons"!


I'm wary of claiming such a skill-level in Python - particularly given 
its incredibly wide range of application. That side of the process can 
be simple or complex - you choose.


[this further to comment after next para]
"Flask" has been mentioned, and over many years Mig has contributed 
numbers of tutorials, videos, articles, and books; which IMHO make it 
easy to understand that package - and most others (in this category). As 
such, I recommend it as a great starting-point, even if that learning 
better-equips you to change to something else later!

(see also mention in other contributions to this thread)


And where it is easy to override using for example plain or template 
HTML, or extend programmatic features using some plugins or just 
subclassing.


Using Python as an 'engine' to generate a web-site, either as a static 
file-set or as part of a web server is relatively trivial. Some of your 
more detailed specs will likely lead you down one or another path. What 
inspiration did you get from reading-up about Flask? Pelican? Other 
suggestions made 'here'? In what way did they not meet the mark?




Do you know of a XML DTD for HTML5 by the way?


See above.
(How is a web page declared to be HTML5, cf any other format? How does 
one ensure that a web page is 'HTML5-compliant'? How does/can one do 
"pretty" in (X)HTML?)

--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: Fwd: Startup problems

2019-08-13 Thread Cameron Simpson

On 13Aug2019 19:05, Vinayak Gopakumar  wrote:

dear developer,
 I'm having problems while starting IDLE 3.7.4. With
this problem, I cannot finish my studies properly. The screenshot of the
problem is attached to this mail.


This list discards all attachments.

A cut/paste of error messages inline in the message text is required to 
show us any errors. (This has the advantage that we can ourselve copy 
that text, which is useful in replies.)



   I hope that you would provide assistance for me for recovering the
above-said problem


Please describe your operating system and where you obtained your ptyhon 
install, and what you did to start IDLE. Otherwise we do not have enough 
context to assist.


Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list


Re: How to plot a data including date and time?

2019-08-13 Thread Chris Angelico
On Wed, Aug 14, 2019 at 8:17 AM Rich Shepard  wrote:
>
> On Tue, 13 Aug 2019, amirrezaheidary...@gmail.com wrote:
>
> > I have a .csv file, in first column I have date and hour, and in the
> > second column I have energy use data. How can I make a bar chart with Date
> > and time as the x axis and the energy use as the Y axis?
>
> First, find yourself a plotting program (R and PSTricks are two I use;
> matplotlib also does a fine job).

Given that we're on python-list here, matplotlib would be the obvious
choice here :)

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


Re: How to plot a data including date and time?

2019-08-13 Thread Rich Shepard

On Tue, 13 Aug 2019, amirrezaheidary...@gmail.com wrote:


I have a .csv file, in first column I have date and hour, and in the
second column I have energy use data. How can I make a bar chart with Date
and time as the x axis and the energy use as the Y axis?


First, find yourself a plotting program (R and PSTricks are two I use;
matplotlib also does a fine job). Second, learn what data format and
manipulation that application uses on provided data. Third, learn that
application/language and plot your data after importing it to the
application.

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


Re: Create multiple sqlite tables, many-to-many design

2019-08-13 Thread Dave via Python-list

On 8/13/19 5:46 PM, Rich Shepard wrote:

On Tue, 13 Aug 2019, Rich Shepard wrote:


Read Joe Celko's books, starting with his SQL Programming Guide, then SQL


That should be SQL Programming Style

Rich


Rich,

On my next trip to BN I'll see if they have them.  That is long term 
though.  Right now I just need to know how to populate the join table 
and anything else that has escaped me.


SQL is cool.  SQL + Python (or C or C++ or Java) is more cool.  Lot 
easier to understand than pointer math in C.


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


How to plot a data including date and time?

2019-08-13 Thread amirrezaheidarysbu
I have a .csv file, in first column I have date and hour, and in the second 
column I have energy use data. How can I make a bar chart with Date and time as 
the x axis and the energy use as the Y axis?

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


Re: Create multiple sqlite tables, many-to-many design

2019-08-13 Thread Rich Shepard

On Tue, 13 Aug 2019, Rich Shepard wrote:


Read Joe Celko's books, starting with his SQL Programming Guide, then SQL


That should be SQL Programming Style

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


Re: Create multiple sqlite tables, many-to-many design

2019-08-13 Thread Chris Angelico
On Wed, Aug 14, 2019 at 7:26 AM Dave via Python-list
 wrote:
> Thanks for the note.  I get the theory of MTM and the join table.  It is
> the implementation I don't get.  Let me see if I can demonstrate my
> confusion using pseudo code.
>
> def dbDataInsert():
>
>  sql_HikeInsert = """ INSERT INTO hike (
>   hike_date,
>   hike_destination,
>   hike_rating,
>   hike_comments )
>   VALUES (
>   hdate,
>   hdestination,
>   hrating,
>   hcomments ) """
>
>  sql_TrailInsert = """ NSERT INTO trail (
>   trail_name,
>   trail_rating,
>   trail_comment )
>VALUES (
>   tname1,
>   trating1,
>   tcomments1 ) """
>
>  sql_TrailInsert = """ NSERT INTO trail (
>   trail_name,
>   trail_rating,
>   trail_comment )
>VALUES (
>   tname2,
>   trating2,
>   tcomments2 ) """
>
>  """ ---> Now what?  I need to populate the join (hike_trail) table.
>   Do I query the tables to get the id's?  Is there another
>   way?  This is the part I really don't get.  """
>

Gotcha!

Some database engines (including PostgreSQL) allow you to add a
RETURNING clause to your INSERT statement, which will then turn it
into a combined "insert, then select from the newly-inserted rows".
SQLite3 does not have this, but there is a special attribute on the
cursor (which you haven't shown in the cut-down example here, but I
presume you know what I'm talking about) to retrieve the ID of the
newly-inserted row:

https://docs.python.org/3/library/sqlite3.html#sqlite3.Cursor.lastrowid

So after inserting into the hike table, you can grab the ID of that
row off the cursor, and then same after the trail. Then you just
insert into the join table using those IDs.

A proper RETURNING clause is far more flexible (it can handle multiple
rows, it can be chained into other queries, etc), but this should be
sufficient for what you're doing here.

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


Re: Create multiple sqlite tables, many-to-many design

2019-08-13 Thread Rich Shepard

On Tue, 13 Aug 2019, Dave via Python-list wrote:


I do indeed. I did that so it was easy for everyone to follow. Having
started with assm. and C, I have to remind myself to be more explanatory
in naming. Guess I over-did it. The actual code is different. htbl, ttbl,
jtbl, etc. Too short?


Dave,

I encourage you to step back and approach your project from a different
side. Databases, especially relational ones using SQL, are a very different
world from Assembly, C, Python, and other procedural/functional/whatever
languages.

Read Joe Celko's books, starting with his SQL Programming Guide, then SQL
for Smarties. A book on relational database design (other than these) would
help. One I've used is Van der Laans' 'Introductory SQL'.

SQL is a set language and thinking in sets is different from thinking in
step-wise procedures. With SQL to tell the engine what you want, not how to
do it. The engine decides the optimal way of getting the results you want
from the tables.

There are three components of SQL; most of us use only two of them: DDL
(Data Definition Language) to define tables and relationships and DML (Data
Manipulation Language) which we use to write queries.

When you get your head around all this consider using Python and SQLAlchemy
with SQLite3, postgresql, or whatever you want for the database back end.

Good luck!

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


Re: Create multiple sqlite tables, many-to-many design

2019-08-13 Thread Dave via Python-list

On 8/13/19 2:59 PM, Chris Angelico wrote:

On Wed, Aug 14, 2019 at 4:50 AM Dave via Python-list
 wrote:

Some of the tables are related.  For example:

Hiking_Table Trails_TableJoining_Table
--
hike_id PK   trail_id  PKhike_id   FK
hike_date  TEXT  trail_name  TEXTtrail_id   FK
hike_destination TEXTtrail_rating REAL
hike_rating  REALtrail_comments TEXT
hike_comments  TEXT

So far, so good.  I know how to create the tables.  What I am struggling
with is how do I insert data into the joining table or don"t I?  If so,
do I need to query the other two tables to get the auto-number ID's?
Some things I have read suggest that the joining table just contains
references, so there is no actual insert.  A pointer to information how
to do this would be appreciated.  As for queries, I think I use joins,
but a pointer on how to do this would also be appreciated.


The joining table is a real thing, and will have real inserts. It
might be easier to think of this as two separate one-to-many
relationships; for the sake of demonstration, I'm going to add another
column to your joining table.

hike_sections ==> hike_id references hikes, trail_id references
trails, companion_name

You've decided to have someone with you for some sections of your
hike. As such, what we have is a number of "mini-hikes" that make up a
single hike (that's a one-to-many relationship between hikes and
sections), and also a single trail can be a section of any number of
hikes (so, another one-to-many relationship between trails and
sections). For any given section, there is exactly one companion.

Does this make the many-to-many relationship a bit easier to
understand? It'll work exactly the same way even if you have no
ancillary information in that joining table.

ChrisA


Chris,

Thanks for the note.  I get the theory of MTM and the join table.  It is 
the implementation I don't get.  Let me see if I can demonstrate my 
confusion using pseudo code.


def dbTables_create (dbpath):

sql_HikeTable = """ CREATE TABLE IF NOT EXISTS hike (
hike_id INTEGER AUTO_INCREMENT PRIMARY KEY,
hike_date TEXT,
hike_destination TEXT,
hike_rating REAL,
hike_comments TEXT ) """

sql_TrailTable = """ CREATE TABLE IF NOT EXISTS trail (
trail_id INTEGER AUTO_INCREMENT PRIMARY KEY,
trail_name TEXT,
trail_rating REAL,
trail_comment TEXT ) """

sql_JoiningTable = """ CREATE TABLE IF NOT EXISTS hike_trail (
hike_id INTEGER
trail_id INTEGER ) """

# Some more code to open connection, create cursor, execute SQL.

def getUserInput ():
# Code to get the user input.
# The user input is:
hdate = "2019-05-28"
hdestination = "Top of White Face Mountain, NY."
hrating = 5.0   # Rating scale 1.0 (bad) to 5.0 (perfect).
hcomments "Got to do again.  Better shoes needed."
tname1 = "Brookside"
trating1 = 4.5
tcomments1 = "Easy"
tname2 = "Wilmington Trail"
trating2 = 4.9
tcomments2 = "Awesome!!"

def dbDataInsert():

sql_HikeInsert = """ INSERT INTO hike (
 hike_date,
 hike_destination,
 hike_rating,
 hike_comments )
 VALUES (
 hdate,
 hdestination,
 hrating,
 hcomments ) """

sql_TrailInsert = """ NSERT INTO trail (
 trail_name,
 trail_rating,
 trail_comment )
  VALUES (
 tname1,
 trating1,
 tcomments1 ) """

sql_TrailInsert = """ NSERT INTO trail (
 trail_name,
 trail_rating,
 trail_comment )
  VALUES (
 tname2,
 trating2,
 tcomments2 ) """

""" ---> Now what?  I need to populate the join (hike_trail) table.
 Do I query the tables to get the id's?  Is there another
 way?  This is the part I really don't get.  """

Dave,


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


Re: Create multiple sqlite tables, many-to-many design

2019-08-13 Thread Dave via Python-list

On 8/13/19 4:45 PM, MRAB wrote:

On 2019-08-13 19:59, Chris Angelico wrote:

On Wed, Aug 14, 2019 at 4:50 AM Dave via Python-list
 wrote:

Some of the tables are related.  For example:

Hiking_Table Trails_Table    Joining_Table
-        -
hike_id PK   trail_id  PK    hike_id   FK
hike_date  TEXT  trail_name  TEXT    trail_id   FK
hike_destination TEXT    trail_rating REAL
hike_rating  REAL    trail_comments TEXT
hike_comments  TEXT

So far, so good.  I know how to create the tables.  What I am struggling
with is how do I insert data into the joining table or don"t I?  If so,
do I need to query the other two tables to get the auto-number ID's?
Some things I have read suggest that the joining table just contains
references, so there is no actual insert.  A pointer to information how
to do this would be appreciated.  As for queries, I think I use joins,
but a pointer on how to do this would also be appreciated.


The joining table is a real thing, and will have real inserts. It
might be easier to think of this as two separate one-to-many
relationships; for the sake of demonstration, I'm going to add another
column to your joining table.

hike_sections ==> hike_id references hikes, trail_id references
trails, companion_name

You've decided to have someone with you for some sections of your
hike. As such, what we have is a number of "mini-hikes" that make up a
single hike (that's a one-to-many relationship between hikes and
sections), and also a single trail can be a section of any number of
hikes (so, another one-to-many relationship between trails and
sections). For any given section, there is exactly one companion.

Does this make the many-to-many relationship a bit easier to
understand? It'll work exactly the same way even if you have no
ancillary information in that joining table.

Might I also suggest dropping unnecessary prefixes from the field names. 
For example, "hike_comments" in "Hiking_Table" can be called just 
"comments" because it's clear from the context that a field called 
"comments" in the hiking table will contain comments about hiking, if 
you see what I mean.


I do indeed.  I did that so it was easy for everyone to follow.  Having 
started with assm. and C, I have to remind myself to be more explanatory 
in naming.  Guess I over-did it.  The actual code is different. htbl, 
ttbl, jtbl, etc.  Too short?


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


Re: Create multiple sqlite tables, many-to-many design

2019-08-13 Thread MRAB

On 2019-08-13 19:59, Chris Angelico wrote:

On Wed, Aug 14, 2019 at 4:50 AM Dave via Python-list
 wrote:

Some of the tables are related.  For example:

Hiking_Table Trails_TableJoining_Table
--
hike_id PK   trail_id  PKhike_id   FK
hike_date  TEXT  trail_name  TEXTtrail_id   FK
hike_destination TEXTtrail_rating REAL
hike_rating  REALtrail_comments TEXT
hike_comments  TEXT

So far, so good.  I know how to create the tables.  What I am struggling
with is how do I insert data into the joining table or don"t I?  If so,
do I need to query the other two tables to get the auto-number ID's?
Some things I have read suggest that the joining table just contains
references, so there is no actual insert.  A pointer to information how
to do this would be appreciated.  As for queries, I think I use joins,
but a pointer on how to do this would also be appreciated.


The joining table is a real thing, and will have real inserts. It
might be easier to think of this as two separate one-to-many
relationships; for the sake of demonstration, I'm going to add another
column to your joining table.

hike_sections ==> hike_id references hikes, trail_id references
trails, companion_name

You've decided to have someone with you for some sections of your
hike. As such, what we have is a number of "mini-hikes" that make up a
single hike (that's a one-to-many relationship between hikes and
sections), and also a single trail can be a section of any number of
hikes (so, another one-to-many relationship between trails and
sections). For any given section, there is exactly one companion.

Does this make the many-to-many relationship a bit easier to
understand? It'll work exactly the same way even if you have no
ancillary information in that joining table.

Might I also suggest dropping unnecessary prefixes from the field names. 
For example, "hike_comments" in "Hiking_Table" can be called just 
"comments" because it's clear from the context that a field called 
"comments" in the hiking table will contain comments about hiking, if 
you see what I mean.

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


Opening Python 3.8 in Visual Studio 2019

2019-08-13 Thread Moe Vyas
Greetings.
Can anyone please, tell me how to open Python 3.8 Interpreter in the Visual
Studio 2019. I have downloaded both of these on my Windows laptop and now
am struggling to make them work together!!?

Thanks in advance.

*Regards*
*Moe Vyas*
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Web framework for static pages

2019-08-13 Thread Joel Goldstick
On Tue, Aug 13, 2019 at 4:12 PM Morten W. Petersen  wrote:
>
> Hi Joel.
>
> I don't disagree with what you're saying, but is there a documented way of 
> making Django produce a neat set of static pages?
>
> It would be nice to use a web application framework to create pages, because 
> it would after that be easy to add a little bit of logic if a customer wants 
> it. A contact form, an order form, etc.

Django has a feature called static pages.. I'm not up to the latest,
but check that you.  Perhaps it will work for you

>
> Zope/Plone has its own set of features and applications I know well, if a 
> customer wants a dynamic website with a lot of logic (dynamic pages).
>
> -Morten
>
> Blogging at http://blogologue.com
> Tweeting at https://twitter.com/blogologue
> On Instagram https://instagram.com/morphexx
>
> tir. 13. aug. 2019, 21.08 skrev Joel Goldstick :
>>
>> On Tue, Aug 13, 2019 at 2:46 PM DL Neil  
>> wrote:
>> >
>> > On 14/08/19 2:26 AM, Grant Edwards wrote:
>> > > On 2019-08-13, Jon Ribbens via Python-list  
>> > > wrote:
>> > >
>> > >> If it's really that small then it sounds like what you are looking for
>> > >> is known as a "text editor".
>> > >
>> > > Bah.  Kids these days.
>> > >
>> > >$ cat > index.hmtl
>> >
>> > [roaring with laughter]
>> >
>> >
>> >
>> > Oh come now. Surely a person with your depth of experience realises that
>> > all cats have moved to Facebook and YouTube, leaving their HTML in
>> > yesterday's litter box?
>> >
>> > --
>> > Regards =dn
>> > --
>> > https://mail.python.org/mailman/listinfo/python-list
>>
>> pardon my drive by comment, but this is close to trolling.  Whatever
>> is offered is shot down.  XHTML seems to have been a road that went
>> nowhere because the browser makers didn't like it.  HTML5 seemed to be
>> a big step forward.  I used a program called Citydesk a long time ago
>> that I think could do what the op might like.  But its long gone.  I
>> think django could be used to make static pages quite easily. Its not
>> hard to learn, and in the event your client wants more, django can do
>> that too
>>
>> --
>> Joel Goldstick
>> http://joelgoldstick.com/blog
>> http://cc-baseballstats.info/stats/birthdays
>> --
>> https://mail.python.org/mailman/listinfo/python-list



-- 
Joel Goldstick
http://joelgoldstick.com/blog
http://cc-baseballstats.info/stats/birthdays
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Web framework for static pages

2019-08-13 Thread Morten W. Petersen
Hi Joel.

I don't disagree with what you're saying, but is there a documented way of
making Django produce a neat set of static pages?

It would be nice to use a web application framework to create pages,
because it would after that be easy to add a little bit of logic if a
customer wants it. A contact form, an order form, etc.

Zope/Plone has its own set of features and applications I know well, if a
customer wants a dynamic website with a lot of logic (dynamic pages).

-Morten

Blogging at http://blogologue.com
Tweeting at https://twitter.com/blogologue
On Instagram https://instagram.com/morphexx

tir. 13. aug. 2019, 21.08 skrev Joel Goldstick :

> On Tue, Aug 13, 2019 at 2:46 PM DL Neil 
> wrote:
> >
> > On 14/08/19 2:26 AM, Grant Edwards wrote:
> > > On 2019-08-13, Jon Ribbens via Python-list 
> wrote:
> > >
> > >> If it's really that small then it sounds like what you are looking for
> > >> is known as a "text editor".
> > >
> > > Bah.  Kids these days.
> > >
> > >$ cat > index.hmtl
> >
> > [roaring with laughter]
> >
> >
> >
> > Oh come now. Surely a person with your depth of experience realises that
> > all cats have moved to Facebook and YouTube, leaving their HTML in
> > yesterday's litter box?
> >
> > --
> > Regards =dn
> > --
> > https://mail.python.org/mailman/listinfo/python-list
>
> pardon my drive by comment, but this is close to trolling.  Whatever
> is offered is shot down.  XHTML seems to have been a road that went
> nowhere because the browser makers didn't like it.  HTML5 seemed to be
> a big step forward.  I used a program called Citydesk a long time ago
> that I think could do what the op might like.  But its long gone.  I
> think django could be used to make static pages quite easily. Its not
> hard to learn, and in the event your client wants more, django can do
> that too
>
> --
> Joel Goldstick
> http://joelgoldstick.com/blog
> http://cc-baseballstats.info/stats/birthdays
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: MySQLdb for 3.6 on RHEL7

2019-08-13 Thread Larry Martell
On Tue, Aug 13, 2019 at 2:16 PM Chris Angelico  wrote:
>
> On Wed, Aug 14, 2019 at 1:48 AM Larry Martell  wrote:
> >
> > On Tue, Aug 13, 2019 at 9:59 AM Chris Angelico  wrote:
> > >
> > > On Tue, Aug 13, 2019 at 11:33 PM Larry Martell  
> > > wrote:
> > > >
> > > > I am trying to install MySQLdb (https://pypi.org/project/mysqlclient/)
> > > > for python3.6 on RHEL7.
> > > >
> > > > When I import it, it fails:
> > > >
> > > > # python3.6
> > > > Python 3.6.8 (default, Jun 11 2019, 15:15:01)
> > > > [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
> > > > Type "help", "copyright", "credits" or "license" for more information.
> > > > >>> import MySQLdb
> > > > Traceback (most recent call last):
> > > >   File "", line 1, in 
> > > >   File 
> > > > "/usr/local/lib64/python3.6/site-packages/mysqlclient-1.4.4-py3.6-linux-x86_64.egg/MySQLdb/__init__.py",
> > > > line 18, in 
> > > > from . import _mysql
> > > > ImportError: 
> > > > /usr/local/lib64/python3.6/site-packages/mysqlclient-1.4.4-py3.6-linux-x86_64.egg/MySQLdb/_mysql.cpython-36m-x86_64-linux-gnu.so:
> > > > undefined symbol: mysql_kill
> > > >
> > > > Has anyone seen and resolved this?
> > >
> > > Not specifically, but that looks like a versioning conflict. Most
> > > likely, your mysqlclient is too old for MySQLdb to connect to.
> > >
> > > Did you get one of them from your system package manager and the other
> > > from pip? If so, try to get both from the same place.
> >
> > So I have MySQL from the system package manager, but mysqlclient is
> > not available there.
>
> That seems very odd. The mysqlclient binary might be just under a
> different name? I'm not familiar with RHEL, but on my Debian, there
> are packages like "mysql-server-5.7" and corresponding
> "mysql-client-5.7". Or do you mean the Python client?

Yes, the python client, which is called mysqlclient but imported as
MySQLdb (https://pypi.org/project/mysqlclient/).

> > And I was not able to get that from pip either,
> > as the install failed. I had to download the source, edit the site.cfg
> > file and build it. But I just found python36-mysql.x86_64 as a package
> > so I uninstalled mysqlclient and installed that from the repo.

The reason that would not install from pip was because the path to
mysql_config was not correct in site.cfg - once I changed that I was
able to build it, but then it gave the other error.

> Based on this, I'm thinking possibly you meant the Python client. It
> may still be that you need to install the C client for the Python one
> to connect to. Although if you got python36-mysql from your system
> repo, that ought to drag in the appropriate mysqlclient. So now I'm
> very confused.
>
> > That did not get the above error, but now I get this:
> >
> > raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is
> > required; you have %s.' % Database.__version__)
> > django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or
> > newer is required; you have 1.3.12.
>
> This claims to be a Django error, though, so maybe the issue here
> isn't with MySQLdb but with Django?? Maybe everything up above is
> actually correctly matched, but too old?

I got around that by changing the code in django to not require that version.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Web framework for static pages

2019-08-13 Thread Joel Goldstick
On Tue, Aug 13, 2019 at 2:46 PM DL Neil  wrote:
>
> On 14/08/19 2:26 AM, Grant Edwards wrote:
> > On 2019-08-13, Jon Ribbens via Python-list  wrote:
> >
> >> If it's really that small then it sounds like what you are looking for
> >> is known as a "text editor".
> >
> > Bah.  Kids these days.
> >
> >$ cat > index.hmtl
>
> [roaring with laughter]
>
>
>
> Oh come now. Surely a person with your depth of experience realises that
> all cats have moved to Facebook and YouTube, leaving their HTML in
> yesterday's litter box?
>
> --
> Regards =dn
> --
> https://mail.python.org/mailman/listinfo/python-list

pardon my drive by comment, but this is close to trolling.  Whatever
is offered is shot down.  XHTML seems to have been a road that went
nowhere because the browser makers didn't like it.  HTML5 seemed to be
a big step forward.  I used a program called Citydesk a long time ago
that I think could do what the op might like.  But its long gone.  I
think django could be used to make static pages quite easily. Its not
hard to learn, and in the event your client wants more, django can do
that too

-- 
Joel Goldstick
http://joelgoldstick.com/blog
http://cc-baseballstats.info/stats/birthdays
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Create multiple sqlite tables, many-to-many design

2019-08-13 Thread Chris Angelico
On Wed, Aug 14, 2019 at 4:50 AM Dave via Python-list
 wrote:
> Some of the tables are related.  For example:
>
> Hiking_Table Trails_TableJoining_Table
> --
> hike_id PK   trail_id  PKhike_id   FK
> hike_date  TEXT  trail_name  TEXTtrail_id   FK
> hike_destination TEXTtrail_rating REAL
> hike_rating  REALtrail_comments TEXT
> hike_comments  TEXT
>
> So far, so good.  I know how to create the tables.  What I am struggling
> with is how do I insert data into the joining table or don"t I?  If so,
> do I need to query the other two tables to get the auto-number ID's?
> Some things I have read suggest that the joining table just contains
> references, so there is no actual insert.  A pointer to information how
> to do this would be appreciated.  As for queries, I think I use joins,
> but a pointer on how to do this would also be appreciated.

The joining table is a real thing, and will have real inserts. It
might be easier to think of this as two separate one-to-many
relationships; for the sake of demonstration, I'm going to add another
column to your joining table.

hike_sections ==> hike_id references hikes, trail_id references
trails, companion_name

You've decided to have someone with you for some sections of your
hike. As such, what we have is a number of "mini-hikes" that make up a
single hike (that's a one-to-many relationship between hikes and
sections), and also a single trail can be a section of any number of
hikes (so, another one-to-many relationship between trails and
sections). For any given section, there is exactly one companion.

Does this make the many-to-many relationship a bit easier to
understand? It'll work exactly the same way even if you have no
ancillary information in that joining table.

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


Create multiple sqlite tables, many-to-many design

2019-08-13 Thread Dave via Python-list

Oops!  Just posted this to the wrong newsgroup.  Sorry!!!


I'm doing a Python app that uses SQLite, and am stumbling on a few 
questions.  I've read a lot of books and documentation, but two 
questions still allude me.  Hope someone that been there done this can 
help.  Below is a note I sent to the SQLite mailing list yesterday.  So 
far, nothing.  Need to get going, so many thanks!


I'm doing an app. that uses sqlite, and has a many-to-many relationship. 
 The areas I need some guidance are:

* Best way to create multiple tables the first time the app. is started.
* How to create a MTM relationship and add/modify data.

I can create tables (Python) by putting the code in discrete functions 
for each table and passing just the path to the database.  I can also 
create a calling function that gets a connection and passes that.  What 
is the pro-con of each since each seems to work?  Better ideas?


Some of the tables are related.  For example:

Hiking_Table Trails_TableJoining_Table
--
hike_id PK   trail_id  PKhike_id   FK
hike_date  TEXT  trail_name  TEXTtrail_id   FK
hike_destination TEXTtrail_rating REAL
hike_rating  REALtrail_comments TEXT
hike_comments  TEXT

So far, so good.  I know how to create the tables.  What I am struggling 
with is how do I insert data into the joining table or don"t I?  If so, 
do I need to query the other two tables to get the auto-number ID's? 
Some things I have read suggest that the joining table just contains 
references, so there is no actual insert.  A pointer to information how 
to do this would be appreciated.  As for queries, I think I use joins, 
but a pointer on how to do this would also be appreciated.


Thanks,
Dave
--
https://mail.python.org/mailman/listinfo/python-list


Re: Web framework for static pages

2019-08-13 Thread DL Neil

On 14/08/19 2:26 AM, Grant Edwards wrote:

On 2019-08-13, Jon Ribbens via Python-list  wrote:


If it's really that small then it sounds like what you are looking for
is known as a "text editor".


Bah.  Kids these days.

   $ cat > index.hmtl


[roaring with laughter]



Oh come now. Surely a person with your depth of experience realises that 
all cats have moved to Facebook and YouTube, leaving their HTML in 
yesterday's litter box?


--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: MySQLdb for 3.6 on RHEL7

2019-08-13 Thread Chris Angelico
On Wed, Aug 14, 2019 at 1:48 AM Larry Martell  wrote:
>
> On Tue, Aug 13, 2019 at 9:59 AM Chris Angelico  wrote:
> >
> > On Tue, Aug 13, 2019 at 11:33 PM Larry Martell  
> > wrote:
> > >
> > > I am trying to install MySQLdb (https://pypi.org/project/mysqlclient/)
> > > for python3.6 on RHEL7.
> > >
> > > When I import it, it fails:
> > >
> > > # python3.6
> > > Python 3.6.8 (default, Jun 11 2019, 15:15:01)
> > > [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
> > > Type "help", "copyright", "credits" or "license" for more information.
> > > >>> import MySQLdb
> > > Traceback (most recent call last):
> > >   File "", line 1, in 
> > >   File 
> > > "/usr/local/lib64/python3.6/site-packages/mysqlclient-1.4.4-py3.6-linux-x86_64.egg/MySQLdb/__init__.py",
> > > line 18, in 
> > > from . import _mysql
> > > ImportError: 
> > > /usr/local/lib64/python3.6/site-packages/mysqlclient-1.4.4-py3.6-linux-x86_64.egg/MySQLdb/_mysql.cpython-36m-x86_64-linux-gnu.so:
> > > undefined symbol: mysql_kill
> > >
> > > Has anyone seen and resolved this?
> >
> > Not specifically, but that looks like a versioning conflict. Most
> > likely, your mysqlclient is too old for MySQLdb to connect to.
> >
> > Did you get one of them from your system package manager and the other
> > from pip? If so, try to get both from the same place.
>
> So I have MySQL from the system package manager, but mysqlclient is
> not available there.

That seems very odd. The mysqlclient binary might be just under a
different name? I'm not familiar with RHEL, but on my Debian, there
are packages like "mysql-server-5.7" and corresponding
"mysql-client-5.7". Or do you mean the Python client?

> And I was not able to get that from pip either,
> as the install failed. I had to download the source, edit the site.cfg
> file and build it. But I just found python36-mysql.x86_64 as a package
> so I uninstalled mysqlclient and installed that from the repo.

Based on this, I'm thinking possibly you meant the Python client. It
may still be that you need to install the C client for the Python one
to connect to. Although if you got python36-mysql from your system
repo, that ought to drag in the appropriate mysqlclient. So now I'm
very confused.

> That did not get the above error, but now I get this:
>
> raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is
> required; you have %s.' % Database.__version__)
> django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or
> newer is required; you have 1.3.12.

This claims to be a Django error, though, so maybe the issue here
isn't with MySQLdb but with Django?? Maybe everything up above is
actually correctly matched, but too old?

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


Re: Web framework for static pages

2019-08-13 Thread Brian Oney via Python-list



On August 13, 2019 4:00:30 PM GMT+02:00, "Morten W. Petersen" 
 wrote:
>Ok. Isn't it a bit splitting of hairs to talk about static site
>generators
>and their templates?
>
>Wouldn't a static site generator that can create a good, usable website
>with little input be desirable?
>
>I could pick and choose CSS templates, HTML templates and write some of
>my
>own, but that takes quite a bit of time.
>
>Yes, my fixation on XML HTML might be a bit purist or perfectionist,
>but
>isn't it strange that there isn't a DTD for XML HTML 5? Is it the
>ability
>to write websites using a text editor only what makes web companies
>continue the malformed input cycle, or is it legacy websites?
>
>-Morten

It's all text. Or do you have a better suggestion?

What is wrong with templates?


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


Re: MySQLdb for 3.6 on RHEL7

2019-08-13 Thread Larry Martell
On Tue, Aug 13, 2019 at 9:59 AM Chris Angelico  wrote:
>
> On Tue, Aug 13, 2019 at 11:33 PM Larry Martell  
> wrote:
> >
> > I am trying to install MySQLdb (https://pypi.org/project/mysqlclient/)
> > for python3.6 on RHEL7.
> >
> > When I import it, it fails:
> >
> > # python3.6
> > Python 3.6.8 (default, Jun 11 2019, 15:15:01)
> > [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
> > Type "help", "copyright", "credits" or "license" for more information.
> > >>> import MySQLdb
> > Traceback (most recent call last):
> >   File "", line 1, in 
> >   File 
> > "/usr/local/lib64/python3.6/site-packages/mysqlclient-1.4.4-py3.6-linux-x86_64.egg/MySQLdb/__init__.py",
> > line 18, in 
> > from . import _mysql
> > ImportError: 
> > /usr/local/lib64/python3.6/site-packages/mysqlclient-1.4.4-py3.6-linux-x86_64.egg/MySQLdb/_mysql.cpython-36m-x86_64-linux-gnu.so:
> > undefined symbol: mysql_kill
> >
> > Has anyone seen and resolved this?
>
> Not specifically, but that looks like a versioning conflict. Most
> likely, your mysqlclient is too old for MySQLdb to connect to.
>
> Did you get one of them from your system package manager and the other
> from pip? If so, try to get both from the same place.

So I have MySQL from the system package manager, but mysqlclient is
not available there. And I was not able to get that from pip either,
as the install failed. I had to download the source, edit the site.cfg
file and build it. But I just found python36-mysql.x86_64 as a package
so I uninstalled mysqlclient and installed that from the repo. That
did not get the above error, but now I get this:

raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is
required; you have %s.' % Database.__version__)
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or
newer is required; you have 1.3.12.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Web framework for static pages

2019-08-13 Thread Jon Ribbens via Python-list
On 2019-08-13, Morten W. Petersen  wrote:
> Ok. Isn't it a bit splitting of hairs to talk about static site generators
> and their templates?

No, not even slightly. You appear to be thinking that static site
generators come with a pre-made set of design templates, and as
far as I am aware they generally do not.

> Wouldn't a static site generator that can create a good, usable website
> with little input be desirable?

That's the purpose of all of them I should imagine.

> I could pick and choose CSS templates, HTML templates and write some of my
> own, but that takes quite a bit of time.

It's time you need to spend. Otherwise, use Wordpress, optionally
with a static site generator plugin.

> Yes, my fixation on XML HTML might be a bit purist or perfectionist, but
> isn't it strange that there isn't a DTD for XML HTML 5? Is it the ability
> to write websites using a text editor only what makes web companies
> continue the malformed input cycle, or is it legacy websites?

I'm not sure why you think that using XML is in any way "pure" or
"perfect", nor why not using XML means your input is "malformed".
Just use HTML 5, and indeed you should check your code to ensure
it is pure, perfect and well-formed.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Web framework for static pages

2019-08-13 Thread Morten W. Petersen
HMTL? Good you weren't in cat input after a newline. 😁

-Morten

Blogging at http://blogologue.com
Tweeting at https://twitter.com/blogologue
On Instagram https://instagram.com/morphexx

tir. 13. aug. 2019, 16.28 skrev Grant Edwards :

> On 2019-08-13, Jon Ribbens via Python-list  wrote:
>
> > If it's really that small then it sounds like what you are looking for
> > is known as a "text editor".
>
> Bah.  Kids these days.
>
>   $ cat > index.hmtl
>
> --
> Grant Edwards   grant.b.edwardsYow! My vaseline is
>   at   RUNNING...
>   gmail.com
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Fwd: Startup problems

2019-08-13 Thread Vinayak Gopakumar
-- Forwarded message -
From: Vinayak Gopakumar 
Date: Tue, Aug 13, 2019 at 5:53 AM
Subject: Startup problems
To: 


dear developer,
  I'm having problems while starting IDLE 3.7.4. With
this problem, I cannot finish my studies properly. The screenshot of the
problem is attached to this mail.
I hope that you would provide assistance for me for recovering the
above-said problem
-- 
https://mail.python.org/mailman/listinfo/python-list


Research Invitation for OSS Community. Many thanks!

2019-08-13 Thread Sophy Guo
Dear Python Community Members,



I am a master student based in the University of Leeds (UK), currently
conducting a research in regards to investigating how open source software
community culture, governance and structure, motivation of
participation influence the innovation capability of OSS community. I found
Python community is very active and supportive with members around the
world, which makes it perfect for this research. I am writing to ask if you
could help to take part in this research for more accurate results.



This research data is to be collected via questionnaire with the anonymous
link below:

https://leedsubs.eu.qualtrics.com/jfe/form/SV_cUPSObEbxQqEX1b



The questionnaire should take you 5-10 minutes to complete. Your
participation is very important to disclose the relationship between
community culture, governance structure, motivation of participation and
the innovation capability of OSS community.



I would very much appreciate if you could help to participate this
research, and if you have any questions about the research, I am happy to
answer, just e-mail me on bn1...@leeds.ac.uk. Thanks a lot!



Best Regards,



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


Re: Web framework for static pages

2019-08-13 Thread Grant Edwards
On 2019-08-13, Jon Ribbens via Python-list  wrote:

> If it's really that small then it sounds like what you are looking for
> is known as a "text editor".

Bah.  Kids these days.

  $ cat > index.hmtl

-- 
Grant Edwards   grant.b.edwardsYow! My vaseline is
  at   RUNNING...
  gmail.com

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


Re: Web framework for static pages

2019-08-13 Thread Morten W. Petersen
Ok. Isn't it a bit splitting of hairs to talk about static site generators
and their templates?

Wouldn't a static site generator that can create a good, usable website
with little input be desirable?

I could pick and choose CSS templates, HTML templates and write some of my
own, but that takes quite a bit of time.

Yes, my fixation on XML HTML might be a bit purist or perfectionist, but
isn't it strange that there isn't a DTD for XML HTML 5? Is it the ability
to write websites using a text editor only what makes web companies
continue the malformed input cycle, or is it legacy websites?

-Morten

Blogging at http://blogologue.com
Tweeting at https://twitter.com/blogologue
On Instagram https://instagram.com/morphexx

tir. 13. aug. 2019, 14.32 skrev Jon Ribbens via Python-list <
python-list@python.org>:

> On 2019-08-13, Morten W. Petersen  wrote:
> > Ideally I'd want a static site generator that makes it easy and quick to
> > create a website which is pretty, accessible, works across browsers and
> > standards compliant and doesn't freeze the browser on a low-end phone.
>
> That isn't what they do. All those requirements are to do with the
> HTML templates that you use for the site, regardless of whether it's
> a static or dynamic site.
>
> > Do you know of a XML DTD for HTML5 by the way?
>
> There isn't one. However I would very strongly recommend NOT using
> XHTML. Nobody uses XHTML and no browsers support it except inasmuch
> as they parse it by pretending it's HTML. Just use the HTML
> representation of HTML 5.
>
> I think the most commonly-used static site generator is probably
> Jekyll. It's in Ruby but that's basically irrelevant unless you're
> a Jekyll developer - as a user you just use the Liquid templating
> system, which is more-or-less identical to Django's.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Web framework for static pages

2019-08-13 Thread Morten W. Petersen
Ok, will take a look at those.

-Morten

Blogging at http://blogologue.com
Tweeting at https://twitter.com/blogologue
On Instagram https://instagram.com/morphexx

tir. 13. aug. 2019, 14.39 skrev Jan Erik Moström :

> On 13 Aug 2019, at 12:54, Morten W. Petersen wrote:
>
> > I was hoping to avoid testing a lot of different systems, spending time
> > there.
>
> Depending on your needs I would look at Hugo or Pelican
>
> = jem
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: MySQLdb for 3.6 on RHEL7

2019-08-13 Thread Chris Angelico
On Tue, Aug 13, 2019 at 11:33 PM Larry Martell  wrote:
>
> I am trying to install MySQLdb (https://pypi.org/project/mysqlclient/)
> for python3.6 on RHEL7.
>
> When I import it, it fails:
>
> # python3.6
> Python 3.6.8 (default, Jun 11 2019, 15:15:01)
> [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import MySQLdb
> Traceback (most recent call last):
>   File "", line 1, in 
>   File 
> "/usr/local/lib64/python3.6/site-packages/mysqlclient-1.4.4-py3.6-linux-x86_64.egg/MySQLdb/__init__.py",
> line 18, in 
> from . import _mysql
> ImportError: 
> /usr/local/lib64/python3.6/site-packages/mysqlclient-1.4.4-py3.6-linux-x86_64.egg/MySQLdb/_mysql.cpython-36m-x86_64-linux-gnu.so:
> undefined symbol: mysql_kill
>
> Has anyone seen and resolved this?

Not specifically, but that looks like a versioning conflict. Most
likely, your mysqlclient is too old for MySQLdb to connect to.

Did you get one of them from your system package manager and the other
from pip? If so, try to get both from the same place.

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


Re: MySQLdb for 3.6 on RHEL7

2019-08-13 Thread Larry Martell
On Tue, Aug 13, 2019 at 9:43 AM Inada Naoki  wrote:
>
> Why do you use RHEL?

That is not my choice.

> I believe people use RHEL to get support from Red Hat, instead of community 
> support.

I do not believe Red Hat supports this package.

>
> 2019年8月13日(火) 22:32 Larry Martell :
>>
>> I am trying to install MySQLdb (https://pypi.org/project/mysqlclient/)
>> for python3.6 on RHEL7.
>>
>> When I import it, it fails:
>>
>> # python3.6
>> Python 3.6.8 (default, Jun 11 2019, 15:15:01)
>> [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> import MySQLdb
>> Traceback (most recent call last):
>>   File "", line 1, in 
>>   File 
>> "/usr/local/lib64/python3.6/site-packages/mysqlclient-1.4.4-py3.6-linux-x86_64.egg/MySQLdb/__init__.py",
>> line 18, in 
>> from . import _mysql
>> ImportError: 
>> /usr/local/lib64/python3.6/site-packages/mysqlclient-1.4.4-py3.6-linux-x86_64.egg/MySQLdb/_mysql.cpython-36m-x86_64-linux-gnu.so:
>> undefined symbol: mysql_kill
>>
>> Has anyone seen and resolved this?
>> --
>> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: MySQLdb for 3.6 on RHEL7

2019-08-13 Thread Inada Naoki
Why do you use RHEL?

I believe people use RHEL to get support from Red Hat, instead of community
support.

2019年8月13日(火) 22:32 Larry Martell :

> I am trying to install MySQLdb (https://pypi.org/project/mysqlclient/)
> for python3.6 on RHEL7.
>
> When I import it, it fails:
>
> # python3.6
> Python 3.6.8 (default, Jun 11 2019, 15:15:01)
> [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import MySQLdb
> Traceback (most recent call last):
>   File "", line 1, in 
>   File
> "/usr/local/lib64/python3.6/site-packages/mysqlclient-1.4.4-py3.6-linux-x86_64.egg/MySQLdb/__init__.py",
> line 18, in 
> from . import _mysql
> ImportError:
> /usr/local/lib64/python3.6/site-packages/mysqlclient-1.4.4-py3.6-linux-x86_64.egg/MySQLdb/_
> mysql.cpython-36m-x86_64-linux-gnu.so:
> undefined symbol: mysql_kill
>
> Has anyone seen and resolved this?
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


MySQLdb for 3.6 on RHEL7

2019-08-13 Thread Larry Martell
I am trying to install MySQLdb (https://pypi.org/project/mysqlclient/)
for python3.6 on RHEL7.

When I import it, it fails:

# python3.6
Python 3.6.8 (default, Jun 11 2019, 15:15:01)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/usr/local/lib64/python3.6/site-packages/mysqlclient-1.4.4-py3.6-linux-x86_64.egg/MySQLdb/__init__.py",
line 18, in 
from . import _mysql
ImportError: 
/usr/local/lib64/python3.6/site-packages/mysqlclient-1.4.4-py3.6-linux-x86_64.egg/MySQLdb/_mysql.cpython-36m-x86_64-linux-gnu.so:
undefined symbol: mysql_kill

Has anyone seen and resolved this?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: About the #python irc channel on freenode.

2019-08-13 Thread Calvin Spealman
The #python channel only allows registered Freenode users in. You can learn
about registration on Freenode here:
https://freenode.net/kb/answer/registration

Once you've got a registered account you can join #python and should find
many helpful people ready to help you.

On Mon, Aug 12, 2019 at 8:00 PM Hongyi Zhao  wrote:

> On Mon, 12 Aug 2019 16:13:41 -0700, Paul Rubin wrote:
>
> > It's always worked ok for me.
>
> But I always be put into the #python-unregistered channel as follows:
>
> --
> Now talking on #python-unregistered
> * Topic for #python-unregistered is: Welcome to #python-unregistered!
> You've been put here because #python requires you to register your
> nickname with Freenode. For more information about registering on
> Freenode, ask #freenode. For more information about #python,#python-*
> moderation, #python-ops.
> * Topic for #python-unregistered set by lvh!~lvh@python/psf/lvh (Fri Jul
> 1 16:44:19 2011)
> -
>
> I've tried to register the nickname as it told. But still cannot success.
>
> Regards
> --
> .: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.
> --
> https://mail.python.org/mailman/listinfo/python-list
>


-- 

CALVIN SPEALMAN

SENIOR QUALITY ENGINEER

cspea...@redhat.com  M: +1.336.210.5107
[image: https://red.ht/sig] 
TRIED. TESTED. TRUSTED. 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Web framework for static pages

2019-08-13 Thread Jon Ribbens via Python-list
On 2019-08-13, Morten W. Petersen  wrote:
> Ideally I'd want a static site generator that makes it easy and quick to
> create a website which is pretty, accessible, works across browsers and
> standards compliant and doesn't freeze the browser on a low-end phone.

That isn't what they do. All those requirements are to do with the
HTML templates that you use for the site, regardless of whether it's
a static or dynamic site.

> Do you know of a XML DTD for HTML5 by the way?

There isn't one. However I would very strongly recommend NOT using
XHTML. Nobody uses XHTML and no browsers support it except inasmuch
as they parse it by pretending it's HTML. Just use the HTML
representation of HTML 5.

I think the most commonly-used static site generator is probably
Jekyll. It's in Ruby but that's basically irrelevant unless you're
a Jekyll developer - as a user you just use the Liquid templating
system, which is more-or-less identical to Django's.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Web framework for static pages

2019-08-13 Thread Morten W. Petersen
I was hoping to avoid testing a lot of different systems, spending time
there.

So that's why I'm asking here.

I don't need a guide to create a website, maybe a refresher on some topics.

Ideally I'd want a static site generator that makes it easy and quick to
create a website which is pretty, accessible, works across browsers and
standards compliant and doesn't freeze the browser on a low-end phone.

And where it is easy to override using for example plain or template HTML,
or extend programmatic features using some plugins or just subclassing.

Do you know of a XML DTD for HTML5 by the way?

-Morten

Blogging at http://blogologue.com
Tweeting at https://twitter.com/blogologue
On Instagram https://instagram.com/morphexx

tir. 13. aug. 2019, 11.39 skrev DL Neil :

> On 13/08/19 10:01 AM, Morten W. Petersen wrote:
> > On 12.08.2019 18:13, Brian Oney wrote:
> >> On August 12, 2019 9:14:55 AM GMT+02:00, morphex 
> >> wrote:
> >>> Hi.
> >>> What frameworks are there for generating static web pages in Python?
> >> I have used:
> >> https://github.com/Frozen-Flask/Frozen-Flask
> >> It's pretty simple. Develop with flask and then "freeze" it.
> >>
> >> I am looking forward to further answers.
> >
> > OK, so now I know Flask can freeze applications. With Zope and Plone, I
> > have a lot of what I need in terms of web application development.
> >
> > What I guess I'm looking for, is something that will help create a
> > static website, in a simple and efficient manner.  Without being bloated.
>
> Which have you examined and rejected/like?
>
>
> > I don't have a lot of hair on my head, but I would be pulling it out
> > because of some of the websites I see today, their heavy-handed use of
> > different Javascript frameworks etc.
>
> True!
>
>
> > How would I go about creating a simple website with a front page, an
> > about page, a product page and a contact page?  Without any server-side
> > handling of data, so it could be entirely served by for example Apache.
>
> There are a thousand and one web-sites and training courses which
> discuss these topics!
>
>
> > And with it having well-formed XHTML, proper CSS, little Javascript,
> > scaling to different screen and web browsers (wow, it's been so long I
> > forgot it was called responsive design) and so on, being a nice little
> > package.
>
> Don't even think about XHTML. HTML5!
>
> Yes, "responsive".
>
>
> As said, there's plenty 'out there'. Today's InBox included reference to
>   << Static site generator that supports Markdown and reST syntax. Powered by
> Python.>>>
> https://github.com/getpelican
>
> It seems they make good use of a number of Python features, which will
> presumably reduce learning-time for Pythonista!
> --
> Regards =dn
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Web framework for static pages

2019-08-13 Thread Morten W. Petersen
Yes. Well, one of the ideas of the web is being able to create a website
using simple tools like that. And I like that idea.

And for one site, either small or very specialized and well-funded, that
would be an OK choice.

However, I want to offer customers websites that cover their needs, without
costing too much.

Also, apart from taking a lot of time, manually changing different websites
using a text editor is tedious and error-prone.

-Morten

Blogging at http://blogologue.com
Tweeting at https://twitter.com/blogologue
On Instagram https://instagram.com/morphexx

tir. 13. aug. 2019, 02.17 skrev Jon Ribbens via Python-list <
python-list@python.org>:

> On 2019-08-12, Morten W. Petersen  wrote:
> > What I guess I'm looking for, is something that will help create a
> > static website, in a simple and efficient manner.  Without being bloated.
> >
> > I don't have a lot of hair on my head, but I would be pulling it out
> > because of some of the websites I see today, their heavy-handed use of
> > different Javascript frameworks etc.
> >
> > How would I go about creating a simple website with a front page, an
> > about page, a product page and a contact page?  Without any server-side
> > handling of data, so it could be entirely served by for example Apache.
>
> If it's really that small then it sounds like what you are looking for
> is known as a "text editor".
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Web framework for static pages

2019-08-13 Thread Morten W. Petersen
Right. That was a useful term, I've got some things to look at there.

-Morten

Blogging at http://blogologue.com
Tweeting at https://twitter.com/blogologue
On Instagram https://instagram.com/morphexx

tir. 13. aug. 2019, 00.29 skrev Cameron Simpson :

> On 13Aug2019 00:01, Morten W. Petersen  wrote:
> >What I guess I'm looking for, is something that will help create a
> >static website, in a simple and efficient manner.  Without being
> >bloated.
> >
> >I don't have a lot of hair on my head, but I would be pulling it out
> >because of some of the websites I see today, their heavy-handed use of
> >different Javascript frameworks etc.
> >
> >How would I go about creating a simple website with a front page, an
> >about page, a product page and a contact page?  Without any
> >server-side handling of data, so it could be entirely served by for
> >example Apache.
> >
> >And with it having well-formed XHTML, proper CSS, little Javascript,
> >scaling to different screen and web browsers (wow, it's been so long I
> >forgot it was called responsive design) and so on, being a nice little
> >package.
>
> The common search term is "static site generator". There are several out
> there. I haven't any experience with which to offer an opinion though.
>
> Cheers,
> Cameron Simpson 
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Web framework for static pages

2019-08-13 Thread DL Neil

On 13/08/19 10:01 AM, Morten W. Petersen wrote:

On 12.08.2019 18:13, Brian Oney wrote:
On August 12, 2019 9:14:55 AM GMT+02:00, morphex  
wrote:

Hi.
What frameworks are there for generating static web pages in Python?

I have used:
https://github.com/Frozen-Flask/Frozen-Flask
It's pretty simple. Develop with flask and then "freeze" it.

I am looking forward to further answers.


OK, so now I know Flask can freeze applications. With Zope and Plone, I 
have a lot of what I need in terms of web application development.


What I guess I'm looking for, is something that will help create a 
static website, in a simple and efficient manner.  Without being bloated.


Which have you examined and rejected/like?


I don't have a lot of hair on my head, but I would be pulling it out 
because of some of the websites I see today, their heavy-handed use of 
different Javascript frameworks etc.


True!


How would I go about creating a simple website with a front page, an 
about page, a product page and a contact page?  Without any server-side 
handling of data, so it could be entirely served by for example Apache.


There are a thousand and one web-sites and training courses which 
discuss these topics!



And with it having well-formed XHTML, proper CSS, little Javascript, 
scaling to different screen and web browsers (wow, it's been so long I 
forgot it was called responsive design) and so on, being a nice little 
package.


Don't even think about XHTML. HTML5!

Yes, "responsive".


As said, there's plenty 'out there'. Today's InBox included reference to 
 <>>

https://github.com/getpelican

It seems they make good use of a number of Python features, which will 
presumably reduce learning-time for Pythonista!

--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list