mastodon-archive icon indicating copy to clipboard operation
mastodon-archive copied to clipboard

No main.py created in windows??

Open slormo opened this issue 2 years ago • 7 comments

After installing the repo as instructed, I ran the command to test it.

C:\Users\****>python3 mastodon-archive archive [email protected]

This returned the error:

C:\Users\****\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe: can't find '__main__' module in 'C:\\Users\\****\\mastodon-archive'

It looks like a main.py file was not created. Any help?

slormo avatar Oct 27 '22 22:10 slormo

Sadly, I have no idea and never tried to install it on a Windows machine. Anybody else?

kensanata avatar Oct 29 '22 07:10 kensanata

Maybe we should include the one created by contrib/debinstall.sh as a file for such cases, so users can simply copy it over manually (would also make packaging easier and the SPEC file for that cleaner)? All windows I have are just for light and fresh air, and the prefixed "MasterShutter" ("MS for my Windows") is a Somfy remote control, so I cannot test there either.

IzzySoft avatar Oct 31 '22 12:10 IzzySoft

@slormo can you pick the contrib/mastodon-archive.py from the linked PR, place that into the mastodon-archive/ directory and see if that works for you?

PS: Keep the file name as-is; Python is not looking for a main.py file but for the "procedure". If you look into the file you'll see what I mean:

#!/usr/bin/env python3
import mastodon_archive

if __name__ == "__main__":
  mastodon_archive.main()

The main() called from there you can find in mastodon_archive/__init__.py as def main. So this wrapper script basically just tells Python where to look :wink:

IzzySoft avatar Nov 01 '22 16:11 IzzySoft

Nope, still doesn't work I'm afraid.

I tried the command, and got this error still.

C:\Users\****>python3 mastodon-archive archive --no-favourites --no-bookmarks [email protected]
C:\Users\****\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe: can't find '__main__' module in 'C:\\Users\\****\\mastodon-archive'

Here's my directory, in case I've done anything wrong. Screenshot 2022-11-02 234211

slormo avatar Nov 02 '22 23:11 slormo

Yes, mastodon-archive.py must be one level up: next to the mastodon-archive directory, not inside.

IzzySoft avatar Nov 03 '22 00:11 IzzySoft

I've moved it to the correct location, but it still throws up the exact same error.

slormo avatar Nov 03 '22 01:11 slormo

Did you call it with

python3 mastodon-archive.py archive --no-favourites --no-bookmarks <account>

i.e. include the .py so Python knows to use the file and not the directory directly?

IzzySoft avatar Nov 03 '22 08:11 IzzySoft