Closed Dinoosawruss closed 1 year ago
That's really weird. What's the error?
It's a FileNotFoundError
which is raised "when you are trying to access a file or a directory that doesn't exist"
So think get_config()
just needs a os.path.isdir
check and if it doesn't create the directory
What's the full traceback? I assume it's happening from cli.py
when getting the config cecause get_user()
has that feature already https://github.com/TechWiz-3/who-unfollowed-me/blob/main/unfollow/unfollow.py#L46
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\mdorm\onedrive\documents\code\python\who-unfollowed-me\unfollow\cli.py", line 17, in <module>
config = get_config()
File "C:\Users\mdorm\onedrive\documents\code\python\who-unfollowed-me\unfollow\config.py", line 290, in get_config
with open(f"{UNFOLLOW_PATH}/unfollow.toml", "w", encoding='utf-8') as config_file:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\mdorm/.unfollow/unfollow.toml'
Should be fixed in #41
Actually this is still an issue, on Pydroid I get the same error which disappears after
$ mkdir ~/.unfollow
Could you please show the full error traceback?
/storage/emulated/0 $ unfollow
Traceback (most recent call last):
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/bin/unfollow", line 5, in <module>
from unfollow.cli import main
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/unfollow/cli.py", line 17, in <module>
config = get_config()
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/unfollow/config.py", line 58, in get_config
with open(f"{UNFOLLOW_PATH}/unfollow.toml", "w") as config_file:
FileNotFoundError: [Errno 2] No such file or directory: '/data/user/0/ru.iiec.pydroid3/app_HOME/.unfollow/unfollow.toml'/storage/emulated/0 $
(In Pydroid ~
is /data/user/0/ru.iiec.pydroid3/app_HOME/
)
Hmm, I'm quite confused as to why this would happen, you're sure you're using the latest version of unfollow
?
IF you are, could you please remove/delete the directory you created then open an interactive Python shell and try:
import os
os.path.exists(os.path.expanduser("~/.unfollow"))
And send output, whether it was True or False
/storage/emulated/0 $ pip list | grep unfollow
unfollow 3.0.0
/storage/emulated/0 $ python
Python 3.9.7 (default, Oct 9 2021, 08:02:40)
[GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.path.exists(os.path.expanduser("~/.unfollow"))
False
>>>
Ok please do pip install -U unfollow
Ensure your version is 5.0.0
. The issue should be fixed
Well, now I get this
...
from unfollow.cli import main
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/unfollow/cli.py", line 17, in <module>
config = get_config()
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/unfollow/config.py", line 683, in get_config
config = toml.loads(default_config)
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/toml/decoder.py", line 478, in loads
raise TomlDecodeError("What? " + group +
toml.decoder.TomlDecodeError: What? bubbles already exists?{'simple': {'welcome_message': 'Welcome to who-unfollowed-me Python implementation by Zac the Wise', 'fetched_followers_message': 'Fetched github followers', 'no_unfollows_message': 'No unfollows!', 'end_message': 'You have {follower_num} followers. Keep up the good work\n', 'thankyou_message': 'Thanks for using this project'}, 'regular': {'welcome_message': ':dancer: [purple]Welcome to[/purple] [red]who-unfollowed-me[/red][blue] Python implementation[/blue] by [#FFD700]Zac the Wise[#FFD700]', 'fetched_followers_message': '[green]✔ [underline]Fetched github followers', 'last_week_unfollowers': '[purple]✔ [underline]Unfollowers from last week', 'no_unfollows_message': '[green]:raised_hands: [underline]No unfollows!', 'end_message': ':fire: You have {follower_num} followers. Keep up the good work\n', 'thankyou_message': ':pray: Thanks for using this project'}, 'panels': {'welcome_message': ':dancer: [purple]Welcome to[/purple] [red]who-unfollowed-me[/red][blue] Python implementation[/blue] by [#FFD700]Zac the Wise[#FFD700]', 'fetched_followers_message': '[green]✔ [underline]Fetched github followers', 'last_week_unfollowers': '[purple]✔ [underline]Unfollowers from last week', 'no_unfollows_message': '[white on #308012] No unfollows! [/white on #308012] ', 'end_message': ':fire: You have {follower_num} followers. Keep up the good work\n', 'thankyou_message': ':pray: Thanks for using this project'}, 'bubbles': {'welcome_message_a': '[white on purple]Welcome to[/white on purple]', 'welcome_message_b': '[white on red]who-unfollowed-me[/white on red]', 'welcome_message_c': '[white on blue]the Python implementation[/white on blue]', 'welcome_message_d': '[white on dark_goldenrod]by Zac the Wise[/white on dark_goldenrod]', 'fetched_followers_message': '[white on cyan]Fetched github followers[/white on cyan]', 'last_week_unfollowers': '[purple]✔ [underline]Unfollowers from last week', 'no_unfollows_message': '[white on green4]No unfollows![/white on green4]', 'end_message_a': '[white on purple]You have {follower_num} followers.[/white on purple]', 'end_message_b': '[white on magenta]Keep up the good work![/white on magenta]', 'thankyou_message': '[white on blue]Thanks for using this project[/white on blue]'}} (line 380 column 1 char 23604)
delete .unfollow
directory then run again
Same result
That's really weird, any ideas @Dinoosawruss?
Same result
Could you send the error traceback just incase it's not the same
Can't really think of why it's should be any different because ultimately it's still running Python 3.9.7
@donno2048 ^^
/storage/emulated/0 $ unfollow
Traceback (most recent call last):
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/bin/unfollow", line 5, in <module>
from unfollow.cli import main
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/unfollow/cli.py", line 26, in <module>
handled_version = config_version_handle(0)
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/unfollow/config.py", line 697, in config_version_handle
_ = get_config(overwrite=True)
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/unfollow/config.py", line 677, in get_config
config = toml.loads(default_config)
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/toml/decoder.py", line 478, in loads
raise TomlDecodeError("What? " + group +
toml.decoder.TomlDecodeError: What? bubbles already exists?{'simple': {'welcome_message': 'Welcome to who-unfollowed-me Python implementation by Zac the Wise', 'fetched_followers_message': 'Fetched github followers', 'no_unfollows_message': 'No unfollows!', 'end_message': 'You have {follower_num} followers. Keep up the good work\n', 'thankyou_message': 'Thanks for using this project'}, 'regular': {'welcome_message': ':dancer: [purple]Welcome to[/purple] [red]who-unfollowed-me[/red][blue] Python implementation[/blue] by [#FFD700]Zac the Wise[#FFD700]', 'fetched_followers_message': '[green]✔ [underline]Fetched github followers', 'last_week_unfollowers': '[purple]✔ [underline]Unfollowers from last week', 'no_unfollows_message': '[green]:raised_hands: [underline]No unfollows!', 'end_message': ':fire: You have {follower_num} followers. Keep up the good work\n', 'thankyou_message': ':pray: Thanks for using this project'}, 'panels': {'welcome_message': ':dancer: [purple]Welcome to[/purple] [red]who-unfollowed-me[/red][blue] Python implementation[/blue] by [#FFD700]Zac the Wise[#FFD700]', 'fetched_followers_message': '[green]✔ [underline]Fetched github followers', 'last_week_unfollowers': '[purple]✔ [underline]Unfollowers from last week', 'no_unfollows_message': '[white on #308012] No unfollows! [/white on #308012] ', 'end_message': ':fire: You have {follower_num} followers. Keep up the good work\n', 'thankyou_message': ':pray: Thanks for using this project'}, 'bubbles': {'welcome_message_a': '[white on purple]Welcome to[/white on purple]', 'welcome_message_b': '[white on red]who-unfollowed-me[/white on red]', 'welcome_message_c': '[white on blue]the Python implementation[/white on blue]', 'welcome_message_d': '[white on dark_goldenrod]by Zac the Wise[/white on dark_goldenrod]', 'fetched_followers_message': '[white on cyan]Fetched github followers[/white on cyan]', 'last_week_unfollowers': '[purple]✔ [underline]Unfollowers from last week', 'no_unfollows_message': '[white on green4]No unfollows![/white on green4]', 'end_message_a': '[white on purple]You have {follower_num} followers.[/white on purple]', 'end_message_b': '[white on magenta]Keep up the good work![/white on magenta]', 'thankyou_message': '[white on blue]Thanks for using this project[/white on blue]'}} (line 380 column 1 char 23604)
/storage/emulated/0 $
Can you send the config file please? @donno2048
The plot thickens 😂
Any update @donno2048
What config file?
What config file?
~/.unfollow/unfollow.toml
I converted the dict from donno's traceback to a toml file and got this:
[simple]
welcome_message = "Welcome to who-unfollowed-me Python implementation by Zac the Wise"
fetched_followers_message = "Fetched github followers"
no_unfollows_message = "No unfollows!"
end_message = "You have {follower_num} followers. Keep up the good work\n"
thankyou_message = "Thanks for using this project"
[regular]
welcome_message = ":dancer: [purple]Welcome to[/purple] [red]who-unfollowed-me[/red][blue] Python implementation[/blue] by [#FFD700]Zac the Wise[#FFD700]"
fetched_followers_message = "[green]✔ [underline]Fetched github followers"
last_week_unfollowers = "[purple]✔ [underline]Unfollowers from last week"
no_unfollows_message = "[green]:raised_hands: [underline]No unfollows!"
end_message = ":fire: You have {follower_num} followers. Keep up the good work\n"
thankyou_message = ":pray: Thanks for using this project"
[panels]
welcome_message = ":dancer: [purple]Welcome to[/purple] [red]who-unfollowed-me[/red][blue] Python implementation[/blue] by [#FFD700]Zac the Wise[#FFD700]"
fetched_followers_message = "[green]✔ [underline]Fetched github followers"
last_week_unfollowers = "[purple]✔ [underline]Unfollowers from last week"
no_unfollows_message = "[white on #308012] No unfollows! [/white on #308012] "
end_message = ":fire: You have {follower_num} followers. Keep up the good work\n"
thankyou_message = ":pray: Thanks for using this project"
[bubbles]
welcome_message_a = "[white on purple]Welcome to[/white on purple]"
welcome_message_b = "[white on red]who-unfollowed-me[/white on red]"
welcome_message_c = "[white on blue]the Python implementation[/white on blue]"
welcome_message_d = "[white on dark_goldenrod]by Zac the Wise[/white on dark_goldenrod]"
fetched_followers_message = "[white on cyan]Fetched github followers[/white on cyan]"
last_week_unfollowers = "[purple]✔ [underline]Unfollowers from last week"
no_unfollows_message = "[white on green4]No unfollows![/white on green4]"
end_message_a = "[white on purple]You have {follower_num} followers.[/white on purple]"
end_message_b = "[white on magenta]Keep up the good work![/white on magenta]"
thankyou_message = "[white on blue]Thanks for using this project[/white on blue]"
Can't see anything there but would still be nice to get the full file
@donno2048 any update?
What config file?
~/.unfollow/unfollow.toml
It's empty
Even if you delete the file and rerun?
Yes
What version are you on now?
Ok please do
pip install -U unfollow
Ensure your version is
5.0.0
. The issue should be fixed
...
Can you delete the ~/.unfollow
directory, rerun the program and see if anything is created?
EDIT: I have tried to recreate the problem but can't
Could you possibly give recreate steps on how you're running it etc
Update: successfully recreated on BlueStacks... investigating
Diagnosis:
I ran a couple of things in Pydroid on Bluestacks and found that /data/user/0/ru.iiec.pydroid3/app_HOME
seems to be the home directory when running in Pydroid
I tried to create a file here to test if we can, which worked It did
I ran an ls -a
against the home dir and found that .unfollow
and unfollow.toml
were created
I noticed that the error was complaining about line 380 of unfollow.toml
so checked this and it seems we have some invalid toml which is ultimately causing the issue
I will commit this change and PR it and hopefully, that will fix the issue. Quite unsure why this doesn't also happen on Windows/other Linux OSs but have struggled to recreate it outside of Pydroid
I cannot test this fix as have no way of running the full code on Pydroid but am assuming that this is the cause
See #67
Hey @donno2048 just checking that PR fixed the issue you were having?
Remember to update to version 5.0.1
The error appears to be gone on BlueStacks
Hey @donno2048 just checking that PR fixed the issue you were having?
Yes!
🥳 thanks guys
If you delete
~/.unfollow
, the program appears to crashHappy to work on a fix for this