rndusr / torf

Python module to create, parse and edit torrent files and magnet links
GNU General Public License v3.0
180 stars 17 forks source link

Make torf work on windows #12

Closed PyR8zdl closed 4 years ago

PyR8zdl commented 4 years ago

os.sched_getaffinity(0) Does not work on windows os.

Switch to multiprocessing.cpu_count() to keep cross platform compatibility

rndusr commented 4 years ago

Thanks for your contribution.

I've changed it so that os.sched_getaffinity(0) is preferred because it uses the number of cores the process is restricted to, not the number of cores that exist. But I can't test it on Windows. Does that still work for you?

PyR8zdl commented 4 years ago

Just tested and it works just fine on windows.

I just wanted to thank you for your work on torf. It is really coming together nicely. I've been using it for my auto upload script and it's nice to be able to have cross-platform modules to make my goal of having my script cross-platform seemless.

rndusr commented 4 years ago

Thank you for your kind words.

I think the only other potential cross-platform issue is excluding hidden files. On Unix they just have a leading "." and that works, but Windows seems to have special file attributes for that and I don't want to implement that without being able to test it.

https://stackoverflow.com/questions/7099290/how-to-ignore-hidden-files-using-os-listdir/14063074#14063074

I don't know how common hidden files are on Windows. Maybe that's not a real issue for torf.

PyR8zdl commented 4 years ago

I'm not a windows user, I just had someone report that error with my script and took a look at it.

I could see If I can get them to try it and we can test it.

Also, I found another implementation. https://stackoverflow.com/questions/284115/cross-platform-hidden-file-detection/6365265#6365265

rndusr commented 4 years ago

OK, if both of us don't really know what the best approach would be, it's probably best to wait for a bug report.

Thanks for the link.