numirias/firefed

Getting 'PosixPath' object is not iterable

shivankar-madaan opened this issue · 13 comments

Running firefed on Mac (using python 3.6.0 with pyenv,hoping that is not a issue)

Got this error for all the options of firefed

firefed addons
Traceback (most recent call last):
  File "/Users/shiv/.pyenv/versions/3.6.0/bin/firefed", line 11, in <module>
    sys.exit(main())
  File "/Users/shiv/.pyenv/versions/3.6.0/lib/python3.6/site-packages/firefed/__main__.py", line 47, in main
    run()
  File "/Users/shiv/.pyenv/versions/3.6.0/lib/python3.6/site-packages/firefed/__main__.py", line 18, in run
    profile = util.profile_dir(args.pop('profile'))
  File "/Users/shiv/.pyenv/versions/3.6.0/lib/python3.6/site-packages/firefed/util.py", line 65, in profile_dir
    profiles = list(read_profiles())
  File "/Users/shiv/.pyenv/versions/3.6.0/lib/python3.6/site-packages/firefed/util.py", line 49, in read_profiles
    config.read(mozilla_dir() / PROFILES_INI)
  File "/Users/shiv/.pyenv/versions/3.6.0/lib/python3.6/configparser.py", line 693, in read
    for filename in filenames:
TypeError: 'PosixPath' object is not iterable

Is there something which I am missing here or I have missed any configuration?
firefed -h seems to work though, just for the heads up.

Thanks for reporting!

There seems to be something wrong with firefed trying to look up the profiles in the standard Mozilla profile path. Probably that's related to you being on Mac while I only test on Linux. As you see there currently isn't a large user base :-)

While I'm getting that fixed - do you mind checking if firefed works if you use an explicit path to a FF profile? E.g.:

firefed -p /exact/path/to/a/firefox/profile addons

Hoping that I have run the right command
I got this

$firefed -p /Users/shiv/Library/Application\ Support/Firefox/Profiles/d6z8asz9.default addons
Traceback (most recent call last):
File "/Users/shiv/.pyenv/versions/3.6.0/bin/firefed", line 11, in <module>
    sys.exit(main())
  File "/Users/shiv/.pyenv/versions/3.6.0/lib/python3.6/site-packages/firefed/__main__.py", line 47, in main
    run()
  File "/Users/shiv/.pyenv/versions/3.6.0/lib/python3.6/site-packages/firefed/__main__.py", line 28, in run
    feature()
  File "/Users/shiv/.pyenv/versions/3.6.0/lib/python3.6/site-packages/firefed/feature/feature.py", line 207, in __call__
    self.prepare()
  File "/Users/shiv/.pyenv/versions/3.6.0/lib/python3.6/site-packages/firefed/feature/addons.py", line 68, in prepare
    addons = list(self.load_addons())
  File "/Users/shiv/.pyenv/versions/3.6.0/lib/python3.6/site-packages/firefed/feature/addons.py", line 74, in load_addons
    data = self.load_json(EXTENSIONS_FILE).get('addons', [])
  File "/Users/shiv/.pyenv/versions/3.6.0/lib/python3.6/site-packages/firefed/feature/feature.py", line 105, in load_json
    data = json.load(f)
  File "/Users/shiv/.pyenv/versions/3.6.0/lib/python3.6/json/__init__.py", line 296, in load
    return loads(fp.read(),
  File "/Users/shiv/.pyenv/versions/3.6.0/lib/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in 
position 5299: ordinal not in range(128)

Thanks, I guess that's another bug (sighs).

The first bug is related to you using Python 3.6.0 which has a bug when using ConfigParser.read() on a pathlib object. I'll patch that, but you should also be able to fix it by upgrading your Python 3.6.4 or so.

The second one is probably related to an addon having a non-ascii name. I'll patch that and get back to you. Thanks for your help.

I made a new release which should resolve both bugs.

Do you mind checking again (pip install --upgrade firefed) with an up-to-date Python (3.6.4)?

Yes it works
I just jumped on to python 3.6.4 with the upgraded firefed version,it runs well but with exception that I need to specify the default profile.
But when I run it without the profile option,I get this

firefed bookmarks
Error: No default profile found. Use --profile to specify one.

In the latest release I added ~/Library/Application Support/Firefox/Profiles as the default profile lookup path on OSX.

Do you mind checking if the local profile lookup works for you now?

You should also be able to list all your local FF profiles with:

firefed --profiles

Also, it should be possible to choose a profile by name instead of the full path, e.g.:

firefed -p default bookmarks

Just updated firefed and tried it
Got this

firefed --profiles
No local profiles found in "/Users/shiv/Library/Application Support/Firefox/Profiles".
firefed -p default bookmarks
Error: Profile "default" not found.
master $ firefed -V
firefed v0.1.12

and Python 3.6.4
Not sure whats missing now

This my file under the profile section

ls /Users/shiv/Library/Application\ Support/Firefox/Profiles/
d6z8asz9.default

I think I mislocated the profiles.ini on OSX. (That's where the profile locations are read from.)

Do you have a profiles.ini file in /Users/shiv/Library/Application\ Support/Firefox?

Found the profiles.ini file under this location

[shiv@Shiv  ~/Library/Application Support/Firefox]  $ ls
Crash Reports  	Pending Pings  	Profiles       	profiles.ini

I corrected the profiles.ini lookup. Do you mind checking once again?

Yes it works now.Awesome!!!
we can close this issue now.

Great! Thanks for your debugging help.