rom1504 / img2dataset

Easily turn large sets of image urls to an image dataset. Can download, resize and package 100M urls in 20h on one machine.
MIT License
3.71k stars 338 forks source link

fix(example): move python code into __main__ #350

Closed Adenialzz closed 10 months ago

Adenialzz commented 1 year ago

python multiprocessing code need to run in __main__

rom1504 commented 1 year ago

in what case does this change something?

rom1504 commented 1 year ago

https://stackoverflow.com/questions/74530990/how-to-run-multiprocessing-pool-code-in-python-without-mentioning-main-envir apparently that's useful only in windows

I don't think img2dataset really works in windows anyway

do you have another use case?

Adenialzz commented 1 year ago

Have you tested that on Linux? I run this example script on Linux and got the error seems like https://github.com/rom1504/img2dataset/issues/176. After I put this code snippet into __main__, it works.

rom1504 commented 1 year ago

Yes it works for me.

What distribution are you using?

On Sun, Oct 8, 2023, 12:22 PM Junjie @.***> wrote:

Have you tested that on Linux? I run this example script on Linux and got the error seems like #176 https://github.com/rom1504/img2dataset/issues/176. After I put this code snippet into main, it works.

— Reply to this email directly, view it on GitHub https://github.com/rom1504/img2dataset/pull/350#issuecomment-1751916133, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR437STCVV37HHWEG2BJLDX6ITAXAVCNFSM6AAAAAA5HDPYXGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONJRHEYTMMJTGM . You are receiving this because you commented.Message ID: @.***>

Adenialzz commented 1 year ago

default multiprocessing

rom1504 commented 1 year ago

ah I meant what linux distribution

Adenialzz commented 1 year ago

Ubuntu 18.04.3 LTS