# Newbie question regarding opening files

**URL:** <https://discourse.julialang.org/t/newbie-question-regarding-opening-files/7856>\
**Category:** New to Julia\
**Created:** [December 19, 2017, 5:10pm UTC](https://discourse.julialang.org/t/newbie-question-regarding-opening-files/7856 "2017-12-19T17:10:27Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajimithing](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@ajimithing](https://discourse.julialang.org/u/ajimithing)\
**Post date:** [December 19, 2017, 5:10pm UTC](https://discourse.julialang.org/t/newbie-question-regarding-opening-files/7856/1 "2017-12-19T17:10:27Z")

</div>

I have no background with computer programming, but am a daily fantasy sports player. I recently came across a paper - “Picking Winners Using Integer Programming” by David Hunter, Juan Pablo Vielma, and Tauhid Zaman.

Maybe I’m in over my head here, but I am trying to run their code - [https://github.com/dscotthunter/Fantasy-Hockey-IP-Code](https://github.com/dscotthunter/Fantasy-Hockey-IP-Code)

I’ve successfully downloaded and run all of the required software, as instructed on the GitHub page.

I downloaded the code in the zip file to my machine (I placed it on my desktop).

Under “running the code” it says to “open the file code\_for\_Github.jl” When I type “code\_for\_Github.jl” into Julia it comes back with “ERROR: UndefVarError: code\_for\_Github not defined”

I’m assuming I am doing something wrong, but just not sure how to proceed to get this code run.

Any help for a newbie would be much appreciated!

-Ryan

---

<div class="post-metadata">

**Author:** ![ExpandingMan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/expandingman/32/866_2.png) [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Post date:** [December 19, 2017, 5:41pm UTC](https://discourse.julialang.org/t/newbie-question-regarding-opening-files/7856/2 "2017-12-19T17:41:03Z")

</div>

I have not looked at their source code, but a general comment I can make is that this particular code is 2 years old and there has been rapid development in both JuMP and Julia itself over that time. Since Julia is still in alpha breaking changes are not uncommon. This situation will change soon with the release of Julia 0.7 (the “true” beta for 1.0). It’s likely that changes would have to be made to the source code to get it to run correctly. If you are serious about using this, you should look for someone to update the code for current Julia and JuMP versions (probably not difficult).

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [December 19, 2017, 6:41pm UTC](https://discourse.julialang.org/t/newbie-question-regarding-opening-files/7856/3 "2017-12-19T18:41:49Z")

</div>

The `code_for_Github.jl` is a Julia script. You can run it from your terminal with:

```bash
julia code_for_Github.jl

```

---

<div class="post-metadata">

**Author:** ![ajimithing](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@ajimithing](https://discourse.julialang.org/u/ajimithing)\
**Post date:** [December 19, 2017, 11:28pm UTC](https://discourse.julialang.org/t/newbie-question-regarding-opening-files/7856/4 "2017-12-19T23:28:22Z")

</div>

So I figured out the initial problem was that I hadn’t properly set my home directory. I got that all sorted out, and tried to run the code…but ended up with this error:

ERROR: LoadError: UndefVarError: GLPKSolverMIP not defined  
Stacktrace:  
[1] one\_lineup\_Type\_4(::DataFrames.DataFrame, ::DataFrames.DataFrame, ::Array{Int64,2}, ::Int64, ::Int64, ::Int64, ::Array{Int64,1}, ::Array{Int64,1}, ::Array{Int64,1}, ::Int64, ::Array{Int64,2}, ::Array{Int64,2}, ::Array{Int64,2}, ::Int64, ::Array{Int64,2}) at /Users/kelseykeith/Desktop/code\_for\_Github.jl:411  
[2] create\_lineups(::Int64, ::Int64, ::String, ::String, ::#one\_lineup\_Type\_4, ::String) at /Users/kelseykeith/Desktop/code\_for\_Github.jl:803  
[3] include\_from\_node1(::String) at ./loading.jl:576  
[4] include(::String) at ./sysimg.jl:14  
while loading /Users/kelseykeith/Desktop/code\_for\_Github.jl, in expression starting on line 873

I searched Google for this error and nothing came up. I made sure to Pkg.add(“GLPKMathProgInterface”) and it came back saying it was already installed.

Any ideas?

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [December 20, 2017, 5:29pm UTC](https://discourse.julialang.org/t/newbie-question-regarding-opening-files/7856/5 "2017-12-20T17:29:01Z")

</div>

I didn’t take a good look, but “Since Julia is still in alpha breaking changes are not uncommon […] It’s likely that changes would have to be made to the source code to get it to run correctly.” isn’t too helpful.

Since the code ran at some point, you just need to have the julia runtime from that time.

[https://julialang.org/downloads/oldreleases.html](https://julialang.org/downloads/oldreleases.html)

I’m guessing it is Julia 0.3. You also need the libraries used at that time with this code. Usually there’s a REQUIRE file that tells you what you need and the minimum version number. Those old version you require no longer work with newer Julia. Waiting for 1.0 will not help, but finding the old software probably will.

---

<div class="post-metadata">

**Author:** ![ExpandingMan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/expandingman/32/866_2.png) [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Post date:** [December 20, 2017, 5:33pm UTC](https://discourse.julialang.org/t/newbie-question-regarding-opening-files/7856/6 "2017-12-20T17:33:21Z")

</div>

Another possibility is checking out [FemtoCleaner.jl](https://github.com/JuliaComputing/FemtoCleaner.jl), though I’m not sure if it will work with something as old as 0.3.

---

<div class="post-metadata">

**Author:** ![ajimithing](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@ajimithing](https://discourse.julialang.org/u/ajimithing)\
**Post date:** [December 20, 2017, 6:38pm UTC](https://discourse.julialang.org/t/newbie-question-regarding-opening-files/7856/7 "2017-12-20T18:38:38Z")

</div>

I got everything running properly. Just had to clean up the GLPK packages. Thanks for all the help everyone.

---

<div class="post-metadata">

**Author:** ![183\_496](https://avatars.discourse-cdn.com/v4/letter/1/df705f/32.png) [@183\_496](https://discourse.julialang.org/u/183_496)\
**Post date:** [January 15, 2018, 5:25am UTC](https://discourse.julialang.org/t/newbie-question-regarding-opening-files/7856/8 "2018-01-15T05:25:47Z")

</div>

I have the same issues. could you explain what cleaning up GLPK packages means? This is all new to me. Thank you

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [January 15, 2018, 7:57am UTC](https://discourse.julialang.org/t/newbie-question-regarding-opening-files/7856/9 "2018-01-15T07:57:48Z")

</div>

I would guess that @ajimithing fixed up the relevant packages, but since I see no commits for either `GLPKMathProgInterface.jl` or `GPLK.jl` in the last month, I assume that they have not been submitted as a pull request.

---

<div class="post-metadata">

**Author:** ![awiden91](https://avatars.discourse-cdn.com/v4/letter/a/58956e/32.png) [@awiden91](https://discourse.julialang.org/u/awiden91)\
**Post date:** [January 2, 2020, 8:52pm UTC](https://discourse.julialang.org/t/newbie-question-regarding-opening-files/7856/11 "2020-01-02T20:52:43Z")

</div>

@Tamas_Papp I am trying to get the code running as well and have made a few changes to get it updated but now running into a LoadError: UndefVarError: i not defined error. Would you be able to help me get it running? I appreciate your time!

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [January 4, 2020, 8:12am UTC](https://discourse.julialang.org/t/newbie-question-regarding-opening-files/7856/12 "2020-01-04T08:12:23Z")

</div>

I can’t help without an MWE.

> [@Please read: make it easier to help you](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757):
>
> Welcome to the Julia Discourse! We are enthusiastic about helping Julia programmers, both beginner and experienced. This public service announcement (PSA) outlines best practices when asking for help. Following these points makes it easier for us to help you and more likely you’ll get a prompt, useful answer. Keywords are highlighted to make it easier to refer to specific points. Choose a descriptive title that captures the key part of your question, eg “plots with multiple axes” instead of …

Generally, regarding the code in the Fantasy Hockey repository: it would be best if someone forked it on Github and updated everything. It is an example that draws many people to Julia, but at the same time it has not been updated for a while. Maybe this fork works:

> **[GitHub - rlc2115/Fantasy-Hockey-IP-Code](https://github.com/rlc2115/Fantasy-Hockey-IP-Code)**
>
> Contribute to rlc2115/Fantasy-Hockey-IP-Code development by creating an account on GitHub.

but I did not try it.

---

<div class="post-metadata">

**Author:** ![awiden91](https://avatars.discourse-cdn.com/v4/letter/a/58956e/32.png) [@awiden91](https://discourse.julialang.org/u/awiden91)\
**Post date:** [January 6, 2020, 1:40am UTC](https://discourse.julialang.org/t/newbie-question-regarding-opening-files/7856/13 "2020-01-06T01:40:42Z")

</div>

Got it, I appreciate all the input. I will try and give this a try and see what happens. Hope you had a great weekend!
