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

TypeError: 'float' object cannot be interpreted as an integer #48

Open
ecarey-paa opened this issue Jan 3, 2023 · 2 comments
Open

TypeError: 'float' object cannot be interpreted as an integer #48

ecarey-paa opened this issue Jan 3, 2023 · 2 comments

Comments

@ecarey-paa
Copy link

ecarey-paa commented Jan 3, 2023

Nice project. Thanks for sharing. Having problem though. Cloned repo. Did a pip install -r requirements.txt. Tried to run gen_captcha.py and I get a TypeError.

I uncommented the tensorflow=2.1.4 line in the requirements.txt file and set it to 2.8.4 since 2.1.4 was not found and the earliest version of tensroflow was 2.8.4.

My env:
MacOS Monteray v12.6
Python 3.10.7

(.env) ➜  captcha-tensorflow git:(master) python datasets/gen_captcha.py -d --npi=4 -n 6
10 choices: 0123456789
generating 6 epoches of captchas in ./images/char-4-epoch-6/train.
Traceback (most recent call last):
  File "/Users/evancarey/prj/captcha-tensorflow/datasets/gen_captcha.py", line 137, in <module>
    gen_dataset()
  File "/Users/evancarey/prj/captcha-tensorflow/datasets/gen_captcha.py", line 80, in gen_dataset
    _gen_captcha(build_file_path('train'), num_per_image, n_epoch, width, height, choices=choices, max_images_count=max_images_count)
  File "/Users/evancarey/prj/captcha-tensorflow/datasets/gen_captcha.py", line 48, in _gen_captcha
    image.write(captcha, fn)
  File "/Users/evancarey/prj/captcha-tensorflow/.env/lib/python3.10/site-packages/captcha/image.py", line 58, in write
    im = self.generate_image(chars)
  File "/Users/evancarey/prj/captcha-tensorflow/.env/lib/python3.10/site-packages/captcha/image.py", line 228, in generate_image
    im = self.create_captcha_image(chars, color, background)
  File "/Users/evancarey/prj/captcha-tensorflow/.env/lib/python3.10/site-packages/captcha/image.py", line 212, in create_captcha_image
    mask = im.convert('L').point(table)
  File "/Users/evancarey/prj/captcha-tensorflow/.env/lib/python3.10/site-packages/PIL/Image.py", line 1651, in point
    return self._new(self.im.point(lut, mode))
TypeError: 'float' object cannot be interpreted as an integer
(.env) ➜  captcha-tensorflow git:(master)
@ecarey-paa
Copy link
Author

My guess so far is it's the versions of Python and Tensorflow. Have not yet found how to install that version of Tensorflow.

@Troodi
Copy link

Troodi commented Oct 15, 2023

@ecarey-paa use captha==0.5.0

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

2 participants