# Convert root file to something readable by python

**URL:** <https://root-forum.cern.ch/t/convert-root-file-to-something-readable-by-python/48262>\
**Category:** Newbie\
**Created:** [January 4, 2022, 7:08pm UTC](https://root-forum.cern.ch/t/convert-root-file-to-something-readable-by-python/48262 "2022-01-04T19:08:50Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![Tmikhail](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/tmikhail/32/26564_2.png) [@Tmikhail](https://root-forum.cern.ch/u/Tmikhail)\
**Post date:** [January 26, 2022, 12:01pm UTC](https://root-forum.cern.ch/t/convert-root-file-to-something-readable-by-python/48262/16 "2022-01-26T12:01:10Z")

</div>

Here is the output of the new script:

```auto
./root2npy -f /home/octopus/Documents/Work/Thesis/Data/ColliderSimulation/LHC1/test023.root -t GammaC -o /home/octopus/Documents/Work/Thesis/Data/ColliderSimulation/LHC1/output.npz
root2npy: scanning leaves...
root2npy: scanning leaves... [done]
root2npy: could not get shape from []float32: []
err: reflect: slice index out of range
panic: reflect: slice index out of range [recovered]
	panic: reflect: slice index out of range

goroutine 1 [running]:
github.com/sbinet/npyio/npy.shapeFrom.func1()
	/home/binet/work/gonum/src/github.com/sbinet/npyio/npy/writer.go:528 +0x125
panic({0xb00d20, 0xdff530})
	/home/binet/sdk/go/src/runtime/panic.go:838 +0x207
reflect.Value.Index({0xaf5520?, 0xc00000c828?, 0x2?}, 0xc000026e98?)
	/home/binet/sdk/go/src/reflect/value.go:1366 +0x16d
github.com/sbinet/npyio/npy.shapeFrom({0xaf5520?, 0xc00000c828?, 0x42eed6?})
	/home/binet/work/gonum/src/github.com/sbinet/npyio/npy/writer.go:531 +0x205
github.com/sbinet/npyio/npy.Write({0xdffee0, 0xc0001c9710}, {0xaf5520?, 0xc00000c828?})
	/home/binet/work/gonum/src/github.com/sbinet/npyio/npy/writer.go:41 +0x1a7
github.com/sbinet/npyio.Write(...)
	/home/binet/work/gonum/src/github.com/sbinet/npyio/npyio.go:125
main.process({0x7ffd31cb37df, 0x4b}, {0x7ffd31cb3784, 0x4d}, {0x7ffd31cb37d5, 0x6})
	/home/binet/work/gonum/src/go-hep.org/x/hep/cmd/root2npy/main.go:225 +0xb69
main.main()
	/home/binet/work/gonum/src/go-hep.org/x/hep/cmd/root2npy/main.go:160 +0x185

```

---

_[View the full topic](https://root-forum.cern.ch/t/convert-root-file-to-something-readable-by-python/48262)._
