Why is it enough to just have Cryptography in my requirements.txt but not in my project itself /u/undernutbutthut Python Education

I discovered the wonders of using Docker to help develop projects. One thing I ran into earlier was a “RuntimeError: 'cryptography' package is required for sha256_password or caching_sha2_password auth methods” when trying to access page on my flask application that retrieves and displays data from the MySQL database. This error was not there yesterday so I am naturally perplexed.

Here is the class object I created to access the MySQL database:

import pymysql import config # import cryptography class baseObject: def setup(self,tn): self.tn = tn self.conn = None self.cur = None self.fields = [] self.errors = [] self.pk = None self.data = [] #data is a list of dictionaries representing rows in our table self.establishConnection() self.getFields() def establishConnection(self): self.conn = pymysql.connect(host=config.db_host, port=3306, user=config.db_user, passwd=config.db_passwd, db=config.db_name, autocommit=True) self.cur = self.conn.cursor(pymysql.cursors.DictCursor) 

Notice how the import cryptography is commented out, and here is my new requirements.txt file:

Flask==2.2.5 PyMySQL==1.1.1 cryptography==44.0.0 

This code works, for now. From my research just having the cryptography package installed in my environment is enough to make this error go away, but why?

submitted by /u/undernutbutthut
[link] [comments]

​r/learnpython I discovered the wonders of using Docker to help develop projects. One thing I ran into earlier was a “RuntimeError: ‘cryptography’ package is required for sha256_password or caching_sha2_password auth methods” when trying to access page on my flask application that retrieves and displays data from the MySQL database. This error was not there yesterday so I am naturally perplexed. Here is the class object I created to access the MySQL database: import pymysql import config # import cryptography class baseObject: def setup(self,tn): self.tn = tn self.conn = None self.cur = None self.fields = [] self.errors = [] self.pk = None self.data = [] #data is a list of dictionaries representing rows in our table self.establishConnection() self.getFields() def establishConnection(self): self.conn = pymysql.connect(host=config.db_host, port=3306, user=config.db_user, passwd=config.db_passwd, db=config.db_name, autocommit=True) self.cur = self.conn.cursor(pymysql.cursors.DictCursor) Notice how the import cryptography is commented out, and here is my new requirements.txt file: Flask==2.2.5 PyMySQL==1.1.1 cryptography==44.0.0 This code works, for now. From my research just having the cryptography package installed in my environment is enough to make this error go away, but why? submitted by /u/undernutbutthut [link] [comments] 

I discovered the wonders of using Docker to help develop projects. One thing I ran into earlier was a “RuntimeError: 'cryptography' package is required for sha256_password or caching_sha2_password auth methods” when trying to access page on my flask application that retrieves and displays data from the MySQL database. This error was not there yesterday so I am naturally perplexed.

Here is the class object I created to access the MySQL database:

import pymysql import config # import cryptography class baseObject: def setup(self,tn): self.tn = tn self.conn = None self.cur = None self.fields = [] self.errors = [] self.pk = None self.data = [] #data is a list of dictionaries representing rows in our table self.establishConnection() self.getFields() def establishConnection(self): self.conn = pymysql.connect(host=config.db_host, port=3306, user=config.db_user, passwd=config.db_passwd, db=config.db_name, autocommit=True) self.cur = self.conn.cursor(pymysql.cursors.DictCursor) 

Notice how the import cryptography is commented out, and here is my new requirements.txt file:

Flask==2.2.5 PyMySQL==1.1.1 cryptography==44.0.0 

This code works, for now. From my research just having the cryptography package installed in my environment is enough to make this error go away, but why?

submitted by /u/undernutbutthut
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *