aviks / Taro.jl

Read and write Excel, Word and PDF documents in Julia
Other
124 stars 25 forks source link

how to set JULIA_COPY_STACKS=1 in jupyter? #67

Closed yummy527 closed 2 years ago

yummy527 commented 2 years ago

When runing in jupyter the code below,

using Taro
Taro.init()
Taro.readxl("result.xls")

Erro occurs.

using Taro

Taro.init()

Taro.readxl("result.xls")

┌ Warning: JavaCall needs the environment variable `JULIA_COPY_STACKS` to be `1` or `yes`.
│ Calling the JVM may result in undefined behavior.
└ @ JavaCall /home/wangxl/.julia/packages/JavaCall/tjlYt/src/JavaCall.jl:53

JavaCall.JavaCallError("Either the environmental variable JULIA_COPY_STACKS must be 1 OR JavaCall must be used on the root Task.")

Stacktrace:
 [1] assertroottask_or_goodenv
   @ ~/.julia/packages/JavaCall/tjlYt/src/jvm.jl:236 [inlined]
 [2] _init(opts::Vector{String})
   @ JavaCall ~/.julia/packages/JavaCall/tjlYt/src/jvm.jl:285
 [3] init()
   @ JavaCall ~/.julia/packages/JavaCall/tjlYt/src/jvm.jl:277
 [4] init()
   @ Taro ~/.julia/packages/Taro/7MUCw/src/Taro.jl:21
 [5] top-level scope
   @ In[1]:2
 [6] eval
   @ ./boot.jl:373 [inlined]
 [7] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
   @ Base ./loading.jl:1196
mkitti commented 2 years ago

See the example in https://julialang.github.io/IJulia.jl/stable/manual/installation/#Installing-additional-Julia-kernels where they set the environment variable JULIA_NUM_THREADS.

yummy527 commented 2 years ago

See the example in https://julialang.github.io/IJulia.jl/stable/manual/installation/#Installing-additional-Julia-kernels where they set the environment variable JULIA_NUM_THREADS.

Thanks. It works.

And another question: the rangefield like A2:B5 in load function must be provided? When a batch of excel files to be read, it is not convenient to provide range in each file.

mkitti commented 2 years ago

And another question: the rangefield like A2:B5 in load function must be provided?

This seems like an upstream issue.

aviks commented 2 years ago

And another question: the rangefield like A2:B5 in load function must be provided?

Well, if you want a rectangular output back, you'll have to specify the bounds of what it reads. The heuristics of which block of values to read is never going to be reliable across all kinds of spreadsheets.

If your sheets are more standardised, you can use the lower level getRow and gelCol functions to fectch the individual cell values.