Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error #16

Open
Dancychen opened this issue Dec 19, 2019 · 8 comments
Open

Error #16

Dancychen opened this issue Dec 19, 2019 · 8 comments

Comments

@Dancychen
Copy link

Dancychen commented Dec 19, 2019

#from pydbgen import pydbgen
myDB=pydbgen.pydb()
testdf= myDB.gen_data_series(data_type='data')
print(testdf)

=====================

Traceback (most recent call last):
File "D:/python/Demopycharm/Test_month/z2020_01_month/Data-collect.py", line 40, in
testdf= myDB.gen_data_series(data_type='data')
File "D:\python\Demopycharm\Myspider\venv\lib\site-packages\pydbgen\pydbgen.py", line 191, in gen_data_series
fake.seed(self.seed)
File "D:\python\Demopycharm\Myspider\venv\lib\site-packages\faker\proxy.py", line 79, in getattribute
raise TypeError(msg)
TypeError: Calling .seed() on instances is deprecated. Use the class method Faker.seed() instead.

@aahventures
Copy link

Try force installing an older version of Faker

pip install Faker==2.0.5

@kvrameshreddy
Copy link

add this import "from faker import Faker"
and change "fake" to "Faker"
Faker.seed(self.seed)

@kbowerma
Copy link

kbowerma commented Jul 21, 2020

Can you expand on that last part @kvrameshreddy?

This is line 12-13

   self.fake=Faker()
   self.seed-seed

should change to waht?

@kvrameshreddy
Copy link

query

I haven't faced any issue at line 12-13. my issue appeared at line 191-192. so i changed accordingly which worked for me.

@kbowerma
Copy link

Thanks but now I get:
NameError: name 'Faker' is not defined

@kvrameshreddy
Copy link

Share the code changes you made

@kbowerma
Copy link

Here it is:

else:
            import pandas as pd
            num=int(num)
            fake=self.fake
            Faker.seed(self.seed)
            lst = []

No worries, I am just using Faker directly

@kvrameshreddy
Copy link

Add this line: "from faker import Faker" after pandas import then it will work fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants