JuliaCN / JuliaCN/Py2Jl

Package doesn't work with even demo.jl

Open
#5 30 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
77
Forks
12
PR merge metrics
No merged PRs in 30d

Description

I'm looking into debugging this, I thought it might be the new improved PyCall not working with this package, but even forcing the rev. you used didn't work:

[I doubt it should matter, but maybe me using Julia Version 1.2.0-DEV.55 is the problem? At least Julia 1.1.1 (or 1.0.x) should work, see next comment. Have not yet checked 1.0.x]

julia> py2jl"""
       def sum_by(f, seq):
           s = 0
           for e in seq:
               s = s + f(e)
           return s
       result = sum_by(lambda x: x * 10, [1, 2, 3])
       """
ERROR: LoadError: "class: Module, attributes: Symbol[:class, :body]."
Stacktrace:
 [1] (::getfield(Py2Jl.ASTGen, Symbol("##12#122")){Nothing,getfield(Py2Jl.ASTGen, Symbol("#trans_block#121")){getfield(Py2Jl.ASTGen, Symbol("##7#114")){Nothing}}})(::Dict{Symbol,Any}) at /home/qwerty/.julia/packages/Py2Jl/G6hOG/src/ASTGen.jl:392
 [2] to_ast(::Nothing, ::Dict{Symbol,Any}) at /home/qwerty/.julia/packages/Py2Jl/G6hOG/src/ASTGen.jl:398
 [3] py2jl(::Nothing, ::String) at /home/qwerty/.julia/packages/Py2Jl/G6hOG/src/Py2Jl.jl:43
 [4] @py2jl_str(::LineNumberNode, ::Module, ::Any) at /home/qwerty/.julia/packages/Py2Jl/G6hOG/src/Py2Jl.jl:51
in expression starting at REPL[5]:1

(v1.2) pkg> st
Status ~/.julia/environments/v1.2/Project.toml
[537997a7] AbstractPlotting v0.9.5
[6e4b80f9] BenchmarkTools v0.4.2
[a93c6f00] DataFrames v0.17.1
[864edb3b] DataStructures v0.15.0
[e9467ef8] GLMakie v0.0.4
[54eb57ff] InteractiveCodeSearch v0.3.0
[6042db11] JDBC v0.4.1
[682c06a0] JSON v0.21.0
[d8e11817] MLStyle v0.3.0
[ee78f7c6] Makie v0.9.1
[dbd62bd0] MakieGallery v0.0.4
[c020b1a1] NaturalSort v0.0.1+ #fix_for_1_0_0 (http://github.com/endrebak/NaturalSort.jl)
[9b87118b] PackageCompiler v0.6.3
[91a5bcdd] Plots v0.26.0
[e53ffe30] Py2Jl v0.1.0 #master (https://github.com/JuliaCN/Py2Jl.jl)
[438e738f] PyCall v1.91.2+ #1309efc (https://github.com/JuliaPy/PyCall.jl.git)
[d330b81b] PyPlot v2.7.0
[bf110322] Python v0.1.0 #master (https://github.com/229668880/Python.jl)
[1a8c2f83] Query v0.11.0
[e6cf234a] RandomNumbers v1.2.0
[f2b01f46] Roots v0.8.1
[3646fa90] ScikitLearn v0.5.0
[992d4aef] Showoff v0.2.1
[98e33af6] SimpleDirectMediaLayer v0.1.0
[276daf66] SpecialFunctions v0.7.2
[65254759] StatsMakie v0.0.2
[9a3f8284] Random

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the demo.jl input and start at src/ASTGen.jl around lines 392-398, then trace the call from src/Py2Jl.jl lines 43 and 51. Done means the supplied Python snippet converts without the reported error and the relevant tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia, python
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.