For this specific case, if you're on Linux, from the command line try
    xvfb-run julia -e 'include("my_plotting_script")'
You'll need xvfb installed, of course.

--Tim

On Monday, December 22, 2014 02:54:49 AM David van Leeuwen wrote:
> Hello,
> 
> I've read some of the discussion related to conditional / optional module
> loading, and I am not sure what the status of
> https://github.com/JuliaLang/julia/pull/6884---I guess it still is open for
> merge.  I'm also not sure if it would address the following.
> 
> I'm in the situation where a (small) part of a package would depend on a
> plotting package, e.g., Winston, but I would like to be able to use most of
> the functionality on a run-time system without interactive graphics
> capabilities.
> 
> A top level `using Winston` now bails out in a command-line-only
> environment, because there is no DISPLAY environment variable that Tk needs
> that is required by Winston.
> 
> A load-at-runtime by including the `using Winston` in a clever `eval`-way
> inside a plotting function, such that an attempt to load the package is
> made only after first call to my plotting function is further complicated
> by the fact that my package needs to import the `plot` function from
> Winston if I want to call this plotting function `plot(::MyType)`.
> 
> Any ideas?
> 
> Thanks,
> 
> ---david
> 
> On Wednesday, August 20, 2014 8:16:33 PM UTC+2, Iain Dunning wrote:
> > Soon you'll be able to use https://github.com/JuliaLang/julia/pull/6884
> > and everything can be much nicer :)
> > 
> > On Wednesday, August 20, 2014 11:52:38 AM UTC-4, Júlio Hoffimann wrote:
> >> Doesn't just adding Main in front solve the problem?
> >> 
> >>>     view = Main.ImageView.view
> >>> 
> >>> --Tim
> >> 
> >> Thanks Tim! It did the trick. The correct solution:
> >> https://github.com/juliohm/ImageQuilting.jl/blob/master/src/imquilt.jl#L2
> >> 2-L28
> >> 
> >> It's not ideal, but it works. It would be much nicer if `using ImageView`
> >> raised an ImportError exception or something rather than relying on the
> >> require() function.
> >> 
> >> I invite everyone to give it a try with a fresh Julia build:
> >> https://github.com/juliohm/ImageQuilting.jl
> >> 
> >> Best,
> >> Júlio.

Reply via email to