Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Token file has .db extension on OS X #3

Closed
pawelad opened this issue Sep 20, 2017 · 2 comments
Closed

Token file has .db extension on OS X #3

pawelad opened this issue Sep 20, 2017 · 2 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@pawelad
Copy link
Owner

pawelad commented Sep 20, 2017

Per comments in #2 , the token file (~/.pymonzo-token) for some reason has a .db extension on OS X which makes pymonzo think it does not exist.

@pawelad pawelad added bug Something isn't working os x labels Sep 20, 2017
@pawelad pawelad added this to the v0.9.1 milestone Sep 20, 2017
@pawelad
Copy link
Owner Author

pawelad commented Sep 20, 2017

I believe this is the reason:

There is quite some indirection here. Follow me carefully.

The shelve module is implemented on top of the anydbm module. This module acts as a facade for 4 different specific DBM implementations, and it will pick the first module available when creating a new database, in the following order:

dbhash (deprecated but still the first anydbm choice). This is a proxy for the bsddb module, .open() is really bsddb.hashopen()
gdbm, Python module for the GNU DBM library, offering more functionality than the dbm module can offer when used with this same lbrary.
dbm, a proxy module using either the ndbm, BSD DB and GNU DBM libraries (choosen when Python is compiled).
dumbdbm, a pure-python implementation.
It is this range of choices that makes shelve files appear to grow extra extensions on different platforms.

The dumbdbm module is the one that adds the .bak, .dat and .dir extensions:

Open a dumbdbm database and return a dumbdbm object. The filename argument is the basename of the database file (without any specific extensions). When a dumbdbm database is created, files with .dat and .dir extensions are created.
The .dir file is moved to .bak as new index dicts are committed for changes made to the data structures.

It means that the other three options for anydbm are not available on your platform.

The other formats may give you other extensions. The dbm module may use .dir, .pag or .db, depending on what library was used for that module.

Source


I think I had it with shelve and will just switch to a regular JSON file.

@pawelad
Copy link
Owner Author

pawelad commented Sep 23, 2017

This should be resolved in v0.10.0

@pawelad pawelad closed this as completed Sep 23, 2017
bartonp pushed a commit to bartonp/pymonzo that referenced this issue Sep 23, 2017
* upstream-master:
  Updated README
  Updated README
  Added 'v' prefix to versions in CHANGELOG.md
  Dev version bump
  Prepare release v0.10.0
  Changed token file format from `shelve` to JSON (pawelad#3)
  Updated `six` library to version 1.11.0
  Dev version bump
  Version bump
  Added deprecation warning about changing token file format (pawelad#4)

# Conflicts:
#	src/pymonzo/monzo_api.py
bartonp added a commit to bartonp/pymonzo that referenced this issue Sep 23, 2017
* upstream-master:
  Updated README
  Updated README
  Added 'v' prefix to versions in CHANGELOG.md
  Dev version bump
  Prepare release v0.10.0
  Changed token file format from `shelve` to JSON (pawelad#3)
  Updated `six` library to version 1.11.0
  Dev version bump
  Version bump
  Added deprecation warning about changing token file format (pawelad#4)

# Conflicts:
#	src/pymonzo/monzo_api.py
@pawelad pawelad self-assigned this Sep 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant