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

Reading excel file: ArgumentError: ref of NULL PyObject #20

Closed
fbanez opened this issue Mar 13, 2016 · 10 comments
Closed

Reading excel file: ArgumentError: ref of NULL PyObject #20

fbanez opened this issue Mar 13, 2016 · 10 comments

Comments

@fbanez
Copy link

fbanez commented Mar 13, 2016

Hi, I am new with Julia. I am trying with ExcelReaders but I get an error.
First, in order to use ExcelReaders I have to do:
ENV["PYTHON"]=""
Pkg.build("PyCall")

It seems to work, but when I try to read some excel file like data = readxl("File.xlsx", "Sheet1!A1:C4"), it gives the error ArgumentError: ref of NULL PyObject

I do not know what is it.
Thank you

@davidanthoff
Copy link
Member

Can you post the full code you are trying to run, and the full output you get?

@fbanez
Copy link
Author

fbanez commented Apr 16, 2016

Sorry! I was out and I forgot to update you. I don't exactly know what I did, but it is working now.
Thnaks!

@ghost
Copy link

ghost commented May 21, 2016

I met the same problem like him.

using ExcelReaders
data = readxl("/Users/neo/Documents/data.xlsx", "Sheet1!A1:C1572")
#=
LoadError: ArgumentError: ref of NULL PyObject
while loading In[19], in expression starting on line 2

 in getindex at /Users/neo/.julia/v0.4/PyCall/src/PyCall.jl:264
 in readxl at /Users/neo/.julia/v0.4/ExcelReaders/src/ExcelReaders.jl:152
=#
Pkg.installed()
#=
Dict{ASCIIString,VersionNumber} with 48 entries:
  "ExcelReaders"      => v"0.4.1"
  "ZMQ"               => v"0.3.1"
  "ArrayViews"        => v"0.6.4"
  "DataStructures"    => v"0.4.4"
  "Compat"            => v"0.7.18"
  "Calculus"          => v"0.1.14"
  "GZip"              => v"0.2.18"
  "Measures"          => v"0.0.2"
  "StatsFuns"         => v"0.2.2"
  "DataFrames"        => v"0.7.2"
  "Showoff"           => v"0.0.7"
  "Distributions"     => v"0.8.10"
  "FixedPointNumbers" => v"0.1.3"
  "SHA"               => v"0.1.2"
  "DualNumbers"       => v"0.2.2"
  "KernelDensity"     => v"0.1.2"
  "Iterators"         => v"0.1.9"
  "ColorTypes"        => v"0.2.2"
  "Gadfly"            => v"0.4.2"
  "Dates"             => v"0.4.4"
  "Contour"           => v"0.1.0"
  "PDMats"            => v"0.4.1"
  "Optim"             => v"0.4.5"
  "SortingAlgorithms" => v"0.0.6"
  "Conda"             => v"0.2.0"
  ⋮                   => ⋮
=#

My julia version:

~ julia --version
julia version 0.4.5

Could you please help me? Thank you!

@davidanthoff davidanthoff reopened this May 23, 2016
@davidanthoff
Copy link
Member

@nixlehrer Could you run Pkg.test("ExcelReaders") and paste the output here? If there is an error with that, could you please try this and report whether it works:

using PyCall
@pyimport math
math.sin(math.pi / 4) - sin(pi / 4)

@ghost
Copy link

ghost commented May 24, 2016

Thank you for your reply!

julia> Pkg.test("ExcelReaders")
INFO: Testing ExcelReaders
INFO: Recompiling stale cache file /Users/neo/.julia/lib/v0.4/PyCall.ji for module PyCall.
INFO: Recompiling stale cache file /Users/neo/.julia/lib/v0.4/ExcelReaders.ji for module ExcelReaders.
INFO: ExcelReaders tests passed
julia> using PyCall

julia> @pyimport math

julia> math.sin(math.pi / 4) - sin(pi / 4)
0.0

It's now working. It seems because that my sheet was not named by 'Sheet1' before I corrected it.

@davidanthoff
Copy link
Member

Ok, thanks!

@shze
Copy link

shze commented Oct 15, 2018

I have hit this problem today on Julia 1.0.2-pre.0 (2018-09-30).

data = openxl("run112+seq+psm.xlsx")
ArgumentError: ref of NULL PyObject

Stacktrace:
 [1] getindex(::PyCall.PyObject, ::String) at /home/sh/.julia/packages/PyCall/0jMpb/src/PyCall.jl:284
 [2] getindex at /home/sh/.julia/packages/PyCall/0jMpb/src/PyCall.jl:294 [inlined]
 [3] openxl(::String) at /home/sh/.julia/packages/ExcelReaders/O29uZ/src/ExcelReaders.jl:64
 [4] top-level scope at In[15]:1

(I'm running this from a Jupyter notebook.)

The sheets in this Excel file have long names with spaces; changing them the SheetN does not help.

Trying to loading a specific sheet results in the same error:
data = readxlsheet("run112+seq+psm.xlsx", "Protein View")

It seems that ExcelReaders is installed correctly:

Pkg.test("ExcelReaders")
   Testing ExcelReaders
    Status `/tmp/tmpQBK8Si/Manifest.toml`
  [34da2185] Compat v1.3.0
  [8f4d0f93] Conda v1.1.1
  ... <omitted 28 lines>
  [cf7118a7] UUIDs  [`@stdlib/UUIDs`]
  [4ec0a83e] Unicode  [`@stdlib/Unicode`]
Test Summary: | Pass  Total
ExcelReaders  |  245    245
   Testing ExcelReaders tests passed 

Any idea how to get this to run? Anything else I could try?

Thanks!

@davidanthoff
Copy link
Member

Hm, any chance you could share the original file? If you can't share it publicly, maybe you could email me a copy?

@shze
Copy link

shze commented Oct 16, 2018

I'll email you the file.

@shze
Copy link

shze commented Oct 25, 2018

Were you able to find anything?

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

No branches or pull requests

3 participants