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

Error: Could not open "'./orders_workflow.png'" for writing #110

Closed
amejiarosario opened this issue Jul 24, 2014 · 26 comments
Closed

Error: Could not open "'./orders_workflow.png'" for writing #110

amejiarosario opened this issue Jul 24, 2014 · 26 comments

Comments

@amejiarosario
Copy link

$ rake doc:workflow MODEL=Order 

Error from ["/usr/bin/dot", "-q1", "-Tpng", "-o'./orders_workflow.png'", "/tmp/graphviz.rb20140724-6086-1i7f866"]:
Error: Could not open "'./orders_workflow.png'" for writing : No such file or directory
/vagrant/lib/tasks/generate_state_machine_diagram.rake:5:in `block (2 levels) in <top (required)>'
Tasks: TOP => doc:workflow
(See full trace by running task with --trace)
# system: ubuntu-trusty-64 / ruby 2.1.2p95 / Rails 4.0.8
# permissions current directory: drwxr-xr-x 32  501 dialout  1088 Jul 24 16:24 .

Any ideas?

@geekq
Copy link
Owner

geekq commented Jul 24, 2014

Did you run with --trace?

You can try to provide the absolute path instead of default '.' in you call to workflow_diagram like

Workflow::Draw::workflow_diagram(ENV['MODEL'].constantize, path: '/my/absolute/path/with/write/permissions'

See also https://github.com/geekq/workflow/blob/master/lib/workflow/draw.rb

@amejiarosario
Copy link
Author

No luck even setting the output path and chmod 0777 to directory...

vagrant@vagrant-ubuntu-trusty-64:/vagrant% foreman run rake --trace doc:workflow MODEL=Order OUT_PATH=/vagrant/tmp
** Invoke doc:workflow (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute doc:workflow
rake aborted!
Error from ["/usr/bin/dot", "-q1", "-Tpng", "-o'/vagrant/tmp/orders_workflow.png'", "/tmp/graphviz.rb20140724-7173-mq9962"]:
Error: Could not open "'/vagrant/tmp/orders_workflow.png'" for writing : No such file or directory
/home/vagrant/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/ruby-graphviz-1.2.1/lib/graphviz/utils.rb:61:in `output_from_command'
/home/vagrant/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/ruby-graphviz-1.2.1/lib/graphviz.rb:600:in `output'
/home/vagrant/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/workflow-1.1.0/lib/workflow/draw.rb:69:in `workflow_diagram'
/vagrant/lib/tasks/generate_state_machine_diagram.rake:5:in `block (2 levels) in <top (required)>'
/home/vagrant/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:240:in `call'
/home/vagrant/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:240:in `block in execute'
/home/vagrant/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:235:in `each'
/home/vagrant/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:235:in `execute'
/home/vagrant/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/vagrant/.rbenv/versions/2.1.2/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/home/vagrant/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/vagrant/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/task.rb:165:in `invoke'
/home/vagrant/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:150:in `invoke_task'
/home/vagrant/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/vagrant/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:106:in `each'
/home/vagrant/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:106:in `block in top_level'
/home/vagrant/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:115:in `run_with_threads'
/home/vagrant/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:100:in `top_level'
/home/vagrant/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:78:in `block in run'
/home/vagrant/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/vagrant/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/home/vagrant/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.3.2/bin/rake:33:in `<top (required)>'
/home/vagrant/.rbenv/versions/2.1.2/bin/rake:23:in `load'
/home/vagrant/.rbenv/versions/2.1.2/bin/rake:23:in `<main>'
Tasks: TOP => doc:workflow

@geekq
Copy link
Owner

geekq commented Jul 25, 2014

The error message is very explicit:

Error: Could not open "'/vagrant/tmp/orders_workflow.png'" for writing : No such file or directory

Did you try touch /vagrant/tmp/orders_workflow.png ?

Did you try running dot manually? The call is in the array: /usr/bin/dot -q1 .... But first ensure the temporary dot file like "/tmp/graphviz.rb20140724-7173-mq9962" in your example exists.

Background:

  • recent versions of workflow use the graphviz gem.
  • The gem calls the dot diagramming tool you installed on your machine.

You will have to debug this (not complicated) interaction.

@warmwater
Copy link

I encounter same error and same --trace messages when I was using JRuby 1.7.13 on Windows 7 x64

@geekq
Copy link
Owner

geekq commented Aug 18, 2014

@warmwater Nice that you can reproduce it (I can't)! What is the result of your debugging then?

@warmwater
Copy link

here is my log:

c:\workspace\osm\taroflow\app\models>rake --trace doc:workflow MODEL=Taro
(in C:/workspace/osm/taroflow)
** Invoke doc:workflow (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute doc:workflow
rake aborted!
Error from ["C:\Program Files (x86)\Graphviz2.38\bin/dot.EXE", "-q1", "-Tpng", "-o'./taros_workflow.png'", "C:\Users\HUANGD~1\AppData\Local\Temp\graphviz.rb20140818-11864-h42vde"]:
Error: Could not open "'./taros_workflow.png'" for writing : No such file or directory
Error: dot: can't open {}
C:/Users/huangdave/.pik/rubies/JRuby-1713/lib/ruby/gems/shared/gems/ruby-graphviz-1.2.1/lib/graphviz/utils.rb:61:in output_from_command' C:/Users/huangdave/.pik/rubies/JRuby-1713/lib/ruby/gems/shared/gems/ruby-graphviz-1.2.1/lib/graphviz.rb:600:inoutput'
C:/Users/huangdave/.pik/rubies/JRuby-1713/lib/ruby/gems/shared/gems/workflow-1.1.0/lib/workflow/draw.rb:69:in workflow_diagram' C:/workspace/osm/taroflow/rakefile:12:in(root)'
org/jruby/RubyProc.java:271:in call' C:/Users/huangdave/.pik/rubies/JRuby-1713/lib/ruby/gems/shared/gems/rake-10.3.2/lib/rake/task.rb:240:inexecute'
org/jruby/RubyArray.java:1613:in each' C:/Users/huangdave/.pik/rubies/JRuby-1713/lib/ruby/gems/shared/gems/rake-10.3.2/lib/rake/task.rb:235:inexecute'
C:/Users/huangdave/.pik/rubies/JRuby-1713/lib/ruby/gems/shared/gems/rake-10.3.2/lib/rake/task.rb:179:in invoke_with_call_chain' C:/Users/huangdave/.pik/rubies/JRuby-1713/lib/ruby/1.9/monitor.rb:211:inmon_synchronize'
C:/Users/huangdave/.pik/rubies/JRuby-1713/lib/ruby/gems/shared/gems/rake-10.3.2/lib/rake/task.rb:172:in invoke_with_call_chain' C:/Users/huangdave/.pik/rubies/JRuby-1713/lib/ruby/gems/shared/gems/rake-10.3.2/lib/rake/task.rb:165:ininvoke'
C:/Users/huangdave/.pik/rubies/JRuby-1713/lib/ruby/gems/shared/gems/rake-10.3.2/lib/rake/application.rb:150:in invoke_task' C:/Users/huangdave/.pik/rubies/JRuby-1713/lib/ruby/gems/shared/gems/rake-10.3.2/lib/rake/application.rb:106:intop_level'
org/jruby/RubyArray.java:1613:in each' C:/Users/huangdave/.pik/rubies/JRuby-1713/lib/ruby/gems/shared/gems/rake-10.3.2/lib/rake/application.rb:106:intop_level'
C:/Users/huangdave/.pik/rubies/JRuby-1713/lib/ruby/gems/shared/gems/rake-10.3.2/lib/rake/application.rb:115:in run_with_threads' C:/Users/huangdave/.pik/rubies/JRuby-1713/lib/ruby/gems/shared/gems/rake-10.3.2/lib/rake/application.rb:100:intop_level'
C:/Users/huangdave/.pik/rubies/JRuby-1713/lib/ruby/gems/shared/gems/rake-10.3.2/lib/rake/application.rb:78:in run' C:/Users/huangdave/.pik/rubies/JRuby-1713/lib/ruby/gems/shared/gems/rake-10.3.2/lib/rake/application.rb:176:instandard
_exception_handling'
C:/Users/huangdave/.pik/rubies/JRuby-1713/lib/ruby/gems/shared/gems/rake-10.3.2/lib/rake/application.rb:75:in run' C:/Users/huangdave/.pik/rubies/JRuby-1713/lib/ruby/gems/shared/gems/rake-10.3.2/bin/rake:33:in(root)'
org/jruby/RubyKernel.java:1081:in load' C:\Users\huangdave\.pik\rubies\JRuby-1713\bin\rake:23:in(root)'
Tasks: TOP => doc:workflow

@warmwater
Copy link

I have also tested on Ubuntu 12.04 server, ruby 1.9.3p545, rails 4.1.4...got same error messages

@geekq
Copy link
Owner

geekq commented Aug 18, 2014

Can you please debug (find the cause)? S. my comments #110 (comment) for the inspiration ;-)

@warmwater
Copy link

Hi @geekq

i created the temp file and png file first in Ubuntu
touch /tmp/graphviz.xxxxxxx
touch ./taro-workflow.png
then executed:
/usr/bin/dot -q1 -Tpng -o'./taro-workflow.png' /tmp/graphviz.xxxxxxx

it shows no error message and png file is empty

got same result on windows 7 (Jruby)

@mbhnyc
Copy link

mbhnyc commented Aug 20, 2014

Seeing this same issue on OSX 10.9.4 as well :(

@ivanoblomov
Copy link

The only way I got it to work was to run it from console:

require 'workflow/draw'; Workflow::Draw::workflow_diagram Order

You'll get the same error, but so long as you don't quit console, you'll have access to the temporary Graphviz command file.

Concatenate the command-line array and run it in another shell to generate the diagram.

@ivanoblomov
Copy link

Note that Mavericks may be complicating things as well. The Graphviz folks recommend upgrading to 2.39...

http://www.graphviz.org/content/dot-jpeg-and-mavericks

@ivanoblomov
Copy link

Ignore the comment about Graphviz 2.39; 2.38.0 behaves identically.

@warmwater
Copy link

hi @geekq

Sorry for late reply

I tried the method in #110 (comment) , I am able to touch /tmp and output folder, I have also tried the absolute path, However it still doesn't work.

No tmp file nor output file has exported,

@jkingsbery
Copy link

Also seeing this on MacOS OX 10.9.5, workflow version 1.1. I tried the absolute path, that didn't work.

There error message is a bit confusing: is it trying to write to './orders_workflow.png' or ./orders_workflow.png, with quotes or without the single quotes?

@jkingsbery
Copy link

For anyone who cares, patching line 69 of draw.rb to be graph.output options[:format] => "#{filename}" seems to fix the issue. This is the same change proposed by nyon's PR.

@geekq geekq closed this as completed in f174a83 Feb 12, 2015
@geekq
Copy link
Owner

geekq commented Feb 12, 2015

I do not use Mac. @jkingsbery can you please test, if the removing single quotes (commit f174a83) helped now?

@geekq
Copy link
Owner

geekq commented Feb 12, 2015

Fails on linux https://travis-ci.org/geekq/workflow/jobs/50497167
Will revert.

@geekq geekq reopened this Feb 12, 2015
@geekq geekq closed this as completed in 403a9e4 Feb 12, 2015
@geekq geekq reopened this Feb 12, 2015
@geekq
Copy link
Owner

geekq commented Feb 12, 2015

Will get rid of graph-viz gem. Without that graphviz generation worked reliably for years.

@hmaack
Copy link

hmaack commented Mar 3, 2015

👍

@loofel
Copy link

loofel commented Mar 10, 2016

applying the fix suggested by @jkingsbery (draw.rb:69 change '#{filename}' to "#{filename}") and changing draw.rb:4 to gem 'ruby-graphviz'#, '~> 1.0.0' worked for me on ubuntu trusty

@rjo
Copy link

rjo commented Apr 21, 2017

has there been any movement on this? I just ran into it again on a new project and can't even remember how i got around it last time.

@mbhnyc
Copy link

mbhnyc commented Apr 24, 2017

not that got checked in i don't think :(

@rogerhu
Copy link

rogerhu commented Jul 18, 2017

See: #203

@rogerhu
Copy link

rogerhu commented Jul 18, 2017

Looks like this fix was patched and then reverted...

@rogerhu
Copy link

rogerhu commented Jul 18, 2017

I'm using ruby-graphviz (1.2.3) so it seems like there are tests that need be to fixed for this patch to go in?

@geekq geekq closed this as completed May 29, 2022
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

10 participants