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

demo fails in v0.1.7 #86

Closed
prjemian opened this issue Mar 12, 2017 · 9 comments
Closed

demo fails in v0.1.7 #86

prjemian opened this issue Mar 12, 2017 · 9 comments
Assignees
Labels

Comments

@prjemian
Copy link
Owner

the demo crashes out, even after the user cache (C:\Users\Pete\AppData\Roaming\punx) is emptied

PS C:\Users\Pete> pip uninstall -y punx
Uninstalling punx-0.1.5:
  Successfully uninstalled punx-0.1.5
PS C:\Users\Pete> pip install punx
Collecting punx
  Downloading punx-0.1.7-py2.py3-none-any.whl (509kB)
	100% |################################| 512kB 321kB/s
Requirement already satisfied: PyGithub in d:\apps\anaconda\lib\site-packages (from punx)
Requirement already satisfied: lxml in d:\apps\anaconda\lib\site-packages (from punx)
Requirement already satisfied: requests in d:\apps\anaconda\lib\site-packages (from punx)
Requirement already satisfied: numpy in d:\apps\anaconda\lib\site-packages (from punx)
Requirement already satisfied: pyRestTable in d:\apps\anaconda\lib\site-packages (from punx)
Requirement already satisfied: h5py in d:\apps\anaconda\lib\site-packages (from punx)
Requirement already satisfied: six in d:\apps\anaconda\lib\site-packages (from h5py->punx)
Installing collected packages: punx
Successfully installed punx-0.1.7
PS C:\Users\Pete> punx -v
0.1.7
PS C:\Users\Pete> punx -h
usage: punx [-h] [-v] {demonstrate,structure,update,validate} ...

Python Utilities for NeXus HDF5 files version: 0.1.7 URL:
http://punx.readthedocs.io

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit

subcommand:
  valid subcommands

  {demonstrate,structure,update,validate}
	demonstrate         demonstrate HDF5 file validation
	structure           show structure of HDF5 or NXDL file
	update              update the local cache of NeXus definitions
	validate            validate a NeXus file

Note: It is only necessary to use the first two (or more) characters of any
subcommand, enough that the abbreviation is unique. Such as: ``demonstrate``
can be abbreviated to ``demo`` or even ``de``.
PS C:\Users\Pete> punx demo
console> punx validate d:\apps\anaconda\lib\site-packages\punx\data\writer_1_3.hdf5
Traceback (most recent call last):
  File "d:\apps\anaconda\lib\runpy.py", line 174, in _run_module_as_main
	"__main__", fname, loader, pkg_name)
  File "d:\apps\anaconda\lib\runpy.py", line 72, in _run_code
	exec code in run_globals
  File "D:\Apps\Anaconda\Scripts\punx.exe\__main__.py", line 9, in <module>
  File "d:\apps\anaconda\lib\site-packages\punx\main.py", line 410, in main
	args.func(args)
  File "d:\apps\anaconda\lib\site-packages\punx\main.py", line 119, in func_demo
	func_validate(args)
  File "d:\apps\anaconda\lib\site-packages\punx\main.py", line 182, in func_validate
	validator = validate.Data_File_Validator(args.infile)
  File "d:\apps\anaconda\lib\site-packages\punx\validate.py", line 198, in __init__
	self.nxdl_rules = nxdlstructure.get_nxdl_rules()
  File "d:\apps\anaconda\lib\site-packages\punx\nxdlstructure.py", line 97, in get_nxdl_rules
	__singleton_nxdl_rules__ = nxdl_rules.NxdlRules()
  File "d:\apps\anaconda\lib\site-packages\punx\nxdl_rules.py", line 96, in __init__
	nxdl_xsd = cache.get_nxdl_xsd()             # NXDL structures
  File "d:\apps\anaconda\lib\site-packages\punx\cache.py", line 213, in get_nxdl_xsd
	xsd_file_name = abs_NXDL_filename(NXDL_SCHEMA_FILE)
  File "d:\apps\anaconda\lib\site-packages\punx\cache.py", line 181, in abs_NXDL_filename
	absolute_name = os.path.abspath(os.path.join(cm.default_file_set.path, file_name))
AttributeError: 'NoneType' object has no attribute 'path'
PS C:\Users\Pete>
@prjemian prjemian added the bug label Mar 12, 2017
@prjemian prjemian added this to the initial public release milestone Mar 12, 2017
@prjemian prjemian self-assigned this Mar 12, 2017
@prjemian
Copy link
Owner Author

This was not caught by the unit testing.

@prjemian
Copy link
Owner Author

Happens with the installed version on Linux, too. But does not happen when running from the source code.

@prjemian
Copy link
Owner Author

It works correctly when installed from the source directory:

prjemian@ookhd ~/.../eclipse/punx $ pip install -U --no-deps .
Processing /home/prjemian/Documents/eclipse/punx
Installing collected packages: punx
  Found existing installation: punx 0.1.7
    Uninstalling punx-0.1.7:
      Successfully uninstalled punx-0.1.7
  Running setup.py install for punx ... done
Successfully installed punx-0.1.7+2.g538d9b9
prjemian@ookhd ~/.../eclipse/punx $ punx -v
0.1.7+2.g538d9b9
prjemian@ookhd ~/.../eclipse/punx $ punx demo
console> punx validate /home/prjemian/Apps/anaconda/lib/python2.7/site-packages/punx/data/writer_1_3.hdf5
:file: writer_1_3.hdf5
:NXDL cache info: release v3.2, c0b9500, source cache
:NXDL GIT sha: c0b950028bd5c7a05ab16d0dfca94fbcf84bdb65
:NXDL GIT date/time: 2016-12-20 18:11:36
:validation results shown: COMMENT ERROR NOTE OK TODO UNUSED WARN

Validation findings
============================ ============================= ====== ================================================
address                      validation                    status comment(s)                                      
============================ ============================= ====== ================================================
/                            * valid NeXus data file       OK     This file is valid by the NeXus standard.       
/                            @NX_class                     OK     file root (assumed): NXroot                     
/                            NXDL review                   TODO   validate with NXroot specification (incomplete) 
/Scan                        validItemName                 NOTE   relaxed re: [A-Za-z_][\w_]*                     
/Scan                        NXDL review                   TODO   validate with NXentry specification (incomplete)
/Scan@NX_class               @NX_class                     OK     known: NXentry                                  
/Scan/data                   /NXentry/NXdata@signal=counts OK     NeXus default plot v3                           
/Scan/data                   NXdata dimension scale(s)     OK     dimension scale(s) verified                     
/Scan/data                   validItemName-strict          OK     strict re: [a-z_][a-z0-9_]*                     
/Scan/data                   NXDL review                   TODO   validate with NXdata specification (incomplete) 
/Scan/data@NX_class          @NX_class                     OK     known: NXdata                                   
/Scan/data@axes              NXdata@axes=two_theta         OK     axes dataset found: two_theta                   
/Scan/data@signal            NXdata group default plot v3  OK     NXdata@signal = counts                          
/Scan/data@two_theta_indices NXdata@two_theta_indices      OK     value = 0: ok                                   
/Scan/data/counts            NXdata@ignoreExtraFields      UNUSED field ignored per NXDL specification            
/Scan/data/two_theta         NXdata@ignoreExtraFields      UNUSED field ignored per NXDL specification            
============================ ============================= ====== ================================================

summary statistics
======= ===== ===========================================================
status  count description                                                
======= ===== ===========================================================
OK      10    meets NeXus specification                                  
NOTE    1     does not meet NeXus specification, but acceptable          
WARN    0     does not meet NeXus specification, not generally acceptable
ERROR   0     violates NeXus specification                               
TODO    3     validation not implemented yet                             
UNUSED  2     optional NeXus item not used in data file                  
COMMENT 0     comment from the punx source code                          
--      --    --                                                         
TOTAL   16    --                                                         
======= ===== ===========================================================

console> punx structure /home/prjemian/Apps/anaconda/lib/python2.7/site-packages/punx/data/writer_1_3.hdf5
/home/prjemian/Apps/anaconda/lib/python2.7/site-packages/punx/data/writer_1_3.hdf5 : NeXus data file
  Scan:NXentry
    @NX_class = NXentry
    data:NXdata
      @NX_class = NXdata
      @signal = counts
      @axes = two_theta
      @two_theta_indices = 0
      counts:NX_INT32[31] = [1037, 1318, 1704, '...', 1321]
        @units = counts
      two_theta:NX_FLOAT64[31] = [17.926079999999999, 17.925909999999998, 17.925750000000001, '...', 17.92108]
        @units = degrees
prjemian@ookhd ~/.../eclipse/punx $ 

@prjemian
Copy link
Owner Author

Suspect something in the packaging.

@prjemian
Copy link
Owner Author

locally built distributions work just fine

pushd dist/
pip install -U --no-deps punx-0.1.7+2.g538d9b9.tar.gz
punx demo
pip install -U --no-deps punx-0.1.7+2.g538d9b9-py2.py3-none-any.whl
punx demo

@prjemian
Copy link
Owner Author

next, download and check the two distributions from https://pypi.python.org/pypi/punx/

@prjemian
Copy link
Owner Author

one item missing: __github_info__.json from each definitions cache

@prjemian
Copy link
Owner Author

source cache in packaged distribution is not being found (discovered this by adding debug statements)

@prjemian
Copy link
Owner Author

That's it, the .json file in the source cache was not packaged

prjemian added a commit that referenced this issue Mar 12, 2017
prjemian added a commit that referenced this issue Mar 12, 2017
prjemian added a commit that referenced this issue Mar 12, 2017
prjemian added a commit that referenced this issue Mar 12, 2017
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