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

AttributeError: 'NoneType' object has no attribute 'split' #21

Open
lyhuangj opened this issue Sep 14, 2019 · 10 comments
Open

AttributeError: 'NoneType' object has no attribute 'split' #21

lyhuangj opened this issue Sep 14, 2019 · 10 comments

Comments

@lyhuangj
Copy link

Traceback (most recent call last):
File "tiler.py", line 223, in
main()
File "tiler.py", line 206, in main
tiles_paths = conf.TILES_FOLDER.split(' ')
AttributeError: 'NoneType' object has no attribute 'split'

@nuno-faria
Copy link
Owner

Did you pass arguments to the script?

You have two ways you can use: python tiler.py path/to/image path/to/tiles_folder/, or python tiler.py and setting the image and the tiles paths in the conf.py file.

@hgq520
Copy link

hgq520 commented Mar 30, 2020

IMAGE_TO_TILE = 'images/'

folder with tiles (ignored if passed as the 2nd arg)

TILES_FOLDER = 'tiles/minecraft'
Can i set it like this?

@nuno-faria
Copy link
Owner

IMAGE_TO_TILE must be an image (ex: IMAGE_TO_TILE = 'some_image.png') and not a folder. The TILES_FOLDER looks correct.

@arbaleast
Copy link

D:\tiler>python tiler.py D:\tiler\images\cake_at_simple.png D:\tiler
Loading tiles
0%| | 0/11 [00:00<?, ?it/s]
Traceback (most recent call last):
File "tiler.py", line 223, in
main()
File "tiler.py", line 216, in main
tiles = load_tiles(tiles_paths)
File "tiler.py", line 85, in load_tiles
tile = read_image(os.path.join(path, tile_name))
File "tiler.py", line 34, in read_image
if img.shape[2] == 3:
AttributeError: 'NoneType' object has no attribute 'shape'

@arbaleast
Copy link

where is the problem? guys

@nuno-faria
Copy link
Owner

The second argument must be a folder with just the tiles. D:\tiler must have other types of files.
Try D:\tiler\tiles\times\gen_times\.

@arbaleast
Copy link

thank you very much

@anjandash
Copy link

Also, check if there are hidden files in the "D:\tiler" folder which are not image types.

@chai-debug
Copy link

I looked at what the people wrote above, and I found that I wrote my address right, no other files, and ran at first, but then still reported the same error.where is the problem?

(base) D:\idea\tiler>python tiler.py ./photo/gen_Lemo ./tiles/lego/gen_lego_h/
Loading tiles
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 125/125 [00:05<00:00, 24.91it/s]
Getting and processing boxes
Traceback (most recent call last):
  File "D:\idea\tiler\tiler.py", line 223, in <module>
    main()
  File "D:\idea\tiler\tiler.py", line 217, in main
    boxes, original_res = get_processed_image_boxes(image_path, tiles)
  File "D:\idea\tiler\tiler.py", line 151, in get_processed_image_boxes
    img = read_image(image_path)
  File "D:\idea\tiler\tiler.py", line 34, in read_image
    if img.shape[2] == 3:
AttributeError: 'NoneType' object has no attribute 'shape'

@chai-debug
Copy link

I know where I m wrong,I used my gen_file.Thanks to open source.

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

6 participants