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

Fix project persistency implementation #4

Closed
suoto opened this issue Jan 27, 2016 · 3 comments
Closed

Fix project persistency implementation #4

suoto opened this issue Jan 27, 2016 · 3 comments
Assignees
Labels
Milestone

Comments

@suoto
Copy link
Owner

suoto commented Jan 27, 2016

Using Pickle to dump/load project objects to a file causes issues when the object is dumped in a Python shell and loaded from another shell that doesn't have access to the objects the original shell had.

For example, building a project within Vim then trying to build it via command line gives the following exception

Traceback (most recent call last):
  File "/home/asouto/bin/runner.py", line 213, in <module>
    main(runner_args)
  File "/home/asouto/bin/runner.py", line 161, in main
    project.readConfigFile()
  File "/home/asouto/utils/vim/vim/bundle/vim-hdl/python/vimhdl/project_builder.py", line 79, in readConfigFile
    obj = pickle.load(open(cache_fname, 'r'))
  File "/home/asouto/utils/vim/vim/bundle/vim-hdl/python/vimhdl/vim_client.py", line 25, in <module>
    import vim
ImportError: No module named vim
@suoto
Copy link
Owner Author

suoto commented Mar 28, 2016

Pickle-like serializers dump whole environment definition and expect the environment to remain somewhat the same and this can't be guaranteed.

This approach will be replaced by using JSON to cache only the required attributes. A good side effect is that since class definitions won't be cached, reusing the same cache with different hdlcc versions should be easier.

@suoto suoto self-assigned this Mar 28, 2016
@suoto
Copy link
Owner Author

suoto commented Mar 28, 2016

Results using JSON seem OK, need more throughout testing.

@suoto
Copy link
Owner Author

suoto commented Mar 29, 2016

Fixing this issue should fix issue #2 as well.

suoto added a commit to suoto/vim-hdl that referenced this issue Mar 29, 2016
suoto added a commit to suoto/vim-hdl that referenced this issue Mar 30, 2016
suoto added a commit to suoto/vim-hdl that referenced this issue Mar 30, 2016
@suoto suoto closed this as completed Mar 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant