Debian Buster: ModuleNotFoundError: No module named 'mysql'

2020-01-18 Thread ^Bart

Hi guys,

I'd like to use Python to connect to my MariaDB db, it works from 
phpmyadmin and if I open a console with mysql -u root -p.


I tried:

$ pip search mysql-connector | grep --color mysql-connector-python

mysql-connector-python (8.0.19)   - MySQL driver 
written in Python
mysql-connector-python-rf (2.2.2) - MySQL driver 
written in Python
mysql-connector-python-dd (2.0.2) - MySQL driver 
written in Python


$ pip install mysql-connector-python-rf

Requirement already satisfied: mysql-connector-python-rf in 
/usr/local/lib/python2.7/dist-packages (2.2.2)


When I try my code (obviously I replaced parameters with mine!):

import mysql.connector

mydb = mysql.connector.connect(
  host="localhost",
  user="root",
  passwd="mypwd"
)

print(mydb)

I have:

Traceback (most recent call last):
  File "/home/gabriele/Corso_4.0/Python/Test_MySQL2.py", line 1, in 


import mysql.connector
ModuleNotFoundError: No module named 'mysql'
>>>

What could I do to fix this issue?! :\

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


Re: Debian Buster: ModuleNotFoundError: No module named 'mysql'

2020-01-18 Thread ^Bart

What could I do to fix this issue?! :\


I understood I have Python 2.7 and Python 3 but I can't install modules 
on Python 3... :\


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


Re: Debian Buster: ModuleNotFoundError: No module named 'mysql'

2020-01-18 Thread Michael Torrie
On 1/18/20 9:03 AM, ^Bart wrote:
>> What could I do to fix this issue?! :\
> 
> I understood I have Python 2.7 and Python 3 but I can't install modules 
> on Python 3... :\
> 
> ^Bart

pip is probably defaulting to Python 2.7. Try using pip3, or this more
explicit syntax:

python3 -m pip install 


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


Re: Debian Buster: ModuleNotFoundError: No module named 'mysql'

2020-01-18 Thread ^Bart

pip is probably defaulting to Python 2.7. Try using pip3, or this more
explicit syntax:


Now it works!

Python 3.7.3 (default, Apr  3 2019, 05:39:12)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license()" for more information.
>>>
== RESTART: /home/gabriele/Corso_4.0/Python/Test_MySQL2.py 
==


>>>

I solved the "issue" by:

# aptitude install python3-pip

$ python3 -m pip install mysql-connector

$ python3 -m pip search mysql-connector | grep --color 
mysql-connector-python


$ python3 -m pip install mysql-connector-python-rf

# aptitude install python3-mysqldb

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


Modules Objects in Python

2020-01-18 Thread M.R.P.
Are modules objects in python?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Modules Objects in Python

2020-01-18 Thread DL Neil via Python-list

On 19/01/20 2:51 PM, M.R.P. wrote:

Are modules objects in python?



Modules offer an independent namespace implemented by a dictionary 
object - so you may dir() (or help()) and moduleNM.__dict__, and thus 
pick-up data values and code-units.


So, they have many characteristics and behaviors in common with classes 
(if that's what you meant by "objects"). However, whereas a module is a 
file and its contents cannot be assumed to have (but should, perhaps) 
some common semantic meaning; you would likely be criticised 
(code-review) for using a class as a container for dissimilar and 
unrelated attributes.



Please review https://docs.python.org/3/library/stdtypes.html ("Other 
Built-in Types and "Special Attributes"), plus possibly 
https://docs.python.org/3/reference/datamodel.html


(for further info about importing modules, refer to both of the above 
and retrieve via indexes/ToCs)



The question is very vague/broad. If the above do not satisfy, then 
please ask again, giving a rationale for the question and/or objective 
for an answer...


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


Re: Modules Objects in Python

2020-01-18 Thread Chris Angelico
On Sun, Jan 19, 2020 at 12:56 PM M.R.P.  wrote:
>
> Are modules objects in python?

Yes, modules are objects. You can import a module, and then work with
it as any other object. You can have a dictionary mapping names to
modules (Python has one of these internally). They have a type, they
can have methods (although it's not common), and they have attributes
including a docstring and some metadata.

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


Python Testimonials With Proofs

2020-01-18 Thread Abdur-Rahmaan Janhangeer
Greetings list,

while exploring zipapp, i came across this quote on Shiv's docs:

<>

Starting with that, i compiled top companies quotes like instagram, quora,
netflix, facebook etc on Python.

https://github.com/Abdur-rahmaanJ/pytestimonials

All quotes have original sources.

I deliberately left out Peter Norvig's quote about Google as i could not
find the source.

I was driving with someone yesterday when i remembered this list and was
telling him about Python at quora etc. He was amazed as he sincerely did
not know Python was being used for serious stuffs at great companies.

Feel free to add more.

Yours,

Abdur-Rahmaan Janhangeer
pythonmembers.club  | github

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