Skip to content

Support for freezing software like py2exe, pyinstaller or Cx_Freeze. #162

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

Closed
wants to merge 1 commit into from

Conversation

grossmj
Copy link

@grossmj grossmj commented Apr 27, 2014

jsonschema doesn't work when "frozen", it will try to open the draft3.json and draft4.json files using invalid paths.

For instance, in the case of Cx_Freeze on Windows it will try to open something like: C:\path_to_build_dir\library.zip\schemas\draft3.json, obviously this fails because library.zip is a zip file, not a directory!

With this correction, the path would be C:\path_to_build_dir\schemas\draft*.json only when the application using jsonshema is frozen.

@grossmj
Copy link
Author

grossmj commented Apr 27, 2014

I've just seen the previous pull request (#161) which may be more appropriate. Your call as long as it solves the freezing issue ;)

Thanks,

@Julian
Copy link
Member

Julian commented Apr 27, 2014

:) Yeah thanks for the alternate patch, appreciated!

I'd really like, here or in #161, a test to make sure this stays working (besides my comment there). Or, at least, to have one of these things run as a tox env. If either of you have any idea there I'd certainly like to hear it, otherwise I'll find some time to investigate.

Julian added a commit that referenced this pull request Apr 27, 2014
Hopefully this makes things like cx_Freeze work, but they appear to all be
special snowflakes and this doesn't appear easy to test.

Credit to @pjdelport for helping clear away some of the smoke.

Closes #161, #162
@Julian
Copy link
Member

Julian commented Apr 27, 2014

Pushed out a fix, would love to hear if that fixes things for you.

Cheers.

@Julian Julian closed this Apr 27, 2014
@grossmj
Copy link
Author

grossmj commented Apr 27, 2014

I am going to test tomorrow when I have access to my Windows with Cx_Freeze installed and will let you know the result.

Cheers,

@grossmj
Copy link
Author

grossmj commented Apr 29, 2014

So far I get the following error. I'll investigate more when I have time, maybe something is required in the cx_freeze setup script.

  File "C:\Python33-32bit\lib\site-packages\jsonschema\_utils.py", line 57, in l
oad_schema
    data = pkgutil.get_data(__package__, "schemas/{0}.json".format(name))
  File "C:\Python33-32bit\lib\pkgutil.py", line 640, in get_data
    return loader.get_data(resource_name)
OSError: [Errno 0] Error: 'jsonschema\\schemas\\draft3.json'

@grossmj
Copy link
Author

grossmj commented Apr 29, 2014

Ok I managed to make it work by adding "zip_includes" to my cx_Freeze setup script. No sure this is the correct way though.

Julian added a commit that referenced this pull request Dec 8, 2017
86f965e Merge pull request #209 from json-schema-org/refactor-format
f056cb7 fix: incorrect relative-json-pointer test, closes #208
814eb16 refactor: split format.json to multiple files, closes #162
870b9f7 Merge pull request #207 from json-schema-org/draft-7-ajv
3d9830a feat: test draft-7 with Ajv
9ce7b4c Merge pull request #200 from handrews/draft-07
cf6e663 Apparently descriptions must be < 60 chars
1042cd6 Update draft coverage information
0680b46 Restore regex format test from draft-03
f58637d Basic relative json pointer tests for format
1b43ffa Partial IRI and IRI-reference test suite
9b020b8 Add idn-email and idn-hostname format tests
ca342c9 Add tests for "date" and "time" formats
0d64501 Tests for contentMediaType and contentEncoding
ea357f3 Update draft coverage information
321db9a Tests for if, then, and else keywords
dedd3f1 Unmodified copy of draft6 tests to draft7

git-subtree-dir: json
git-subtree-split: 86f965e53dda0b6c57e70ddd726243e1e061cf84
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants