ruby -v = 1.9.1p378; rails -v = 2.3.8
wkhtmltopdf works just fine from the command line - generates a PDF. The path to the .exe is in the %PATH% variable as well as specified properly in the /config/initializers/wicked_pdf.rb file.
Set up the controller action to handler .pdf format but I get the following error
Permission denied - c:/Ruby191/bin/wkhtmltopdf - -
C:/Ruby191/lib/ruby/1.9.1/open3.rb:67:in 'spawn'
C:/Ruby191/lib/ruby/1.9.1/open3.rb:67:in 'popen3'
C:/work/hello/vendor/plugins/wicked_pdf/lib/wicked_pdf.rb:21:in 'pdf_from_string'
C:/work/hello/vendor/plugins/wicked_pdf/lib/pdf_helper.rb:28:in 'make_pdf'
C:/work/hello/vendor/plugins/wicked_pdf/lib/pdf_helper.rb:39:in 'make_and_send_pdf'
C:/work/hello/vendor/plugins/wicked_pdf/lib/pdf_helper.rb:13:in 'render_with_wicked_pdf'
... controller related code follows ...
I've tried putting the wkhtmltopdf.exe (and related files) in various directories and checked permissions on those dirs to allow full control to Everyone.
Any help as to where the permission problem might be would be appreciated.
As a note: this works just fine run from the command line ruby pdftest.rb
require 'open3'
Open3.popen3('/bin/tools/wkhtmltopdf.exe http://www.google.com/ g.pdf')
The PDF is created with remarkable speed and no permission problems. Could be a problem with the account running WEBrick but I would think that would be solved by giving Everyone permission on the dir that has wkhtmltopdf.exe
I had to answer my own question. I'm stupid sometimes you know.
In the :exe_path variable I had put the path to the exe not including the name of the exe. when I added wkhtmltopdf.exe to the end of my existing path I fixed the permissions issue.
Posted in case someone else has the same issue.
Related
ugh! In the course of working in my perfectly good rails environment, I did something bad:
While running my local sandbox, looking in Chrome developer tools/sources (this is for our own codebase), I clicked an item in the sources list and doing so prompted downloading a file: Roboto-Regular-e60d1ba1cef90e4a4da5c9e2fe1ec3b1.woff2
I got a "threat detected" popup
I submitted the screen I was on, and saw an error to the effect of 'no data', and rails server had stopped
Now I'm having the following symptoms:
Typing "rails server" (or even just "rails") gives me a "No such file or directory" error for /usr/local/Cellar/rbenv/1.1.1/libexec/rbenv.
the following script (with no modifications since its original create date last year) has the line looking for that file : /.rbenv/shims/rails
in the directory in question (libexec), I don't see a plain "rbenv" file, only these with more specific names: rbenv---version, rbenv-help, rbenv-realpath.dylib, rbenv-version, rbenv-version-origin, rbenv-commands, rbenv-hooks, rbenv-root, rbenv-version-file, rbenv-versions, rbenv-completions, rbenv-init, rbenv-sh-rehash, rbenv-version-file-read, rbenv-whence, rbenv-exec, rbenv-local, rbenv-sh-shell, rbenv-version-file-write, rbenv-which rbenv-global, rbenv-prefix, rbenv-shims, rbenv-version-name
I've just used homebrew to upgrade rbenv, but the symptom is still the same.
My $PATH variable has:
-bash: /Users/drkaplan/.rvm/gems/ruby-2.2.2/bin:/Users/drkaplan/.rvm/gems/ruby-2.2.2#global/bin:/Users/drkaplan/.rvm/rubies/ruby-2.2.2/bin:/Users/drkaplan/.rvm/bin:/Users/drkaplan/.nvm/versions/node/v6.11.2/bin:/Users/drkaplan/google-cloud-sdk/bin:/Users/drkaplan/.rbenv/shims:/Users/drkaplan/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/Applications/Postgres.app/Contents/Versions/latest/bin: No such file or directory
Ideas for where to look next?
The solution in this case was to reinstall rails:
gem install rails
I am using Sublime Text 2 while following Michael Hartl's Ruby on Rails Tutorial.
The specific portion of the tutorial to which I am referring can be found at http://ruby.railstutorial.org/book/ruby-on-rails-tutorial (ctrl+F "Listing 5.26").
I am able to create the spec/support file. However, when trying to create the spec/support/utilities.rb file, I receive the message "Unable to save ~/rails_projects/sample_app/spec/support/utilities.rb".
Does anyone know why this might be?
Someone on the Sublime Text forum seems to have had the exact same problem: http://www.sublimetext.com/forum/viewtopic.php?f=3&t=8570&p=36922#p36922
This issue sounds like it's a result of incorrect permissions or ownership of the folder. Change directories (cd) so you're outside of the folder where you're creating the .rb file and type:
ls -l
This terminal command lists the permissions attached to all files/folders in that directory. If "root" is listed as the folder owner, change its owner by typing:
sudo chown YOUR_COMP_USER_NAME FOLDER_NAME/
You should now be able to save files from inside that folder.
To diagnose this, first find out if it's an issue in Sublime or your file system:
Does that file already exist? Try looking for it on your file system (not using Sublime).
Verify that you have permission to write to that file. Use "ls -la" on the command line to show the file permissions.
Are you able to create and/or save that file using any different editor, for example TextMate, or Notepad?
The following sublime plugin fixed the Unable to save... bug
https://gist.github.com/3779601
The folder spec/support doesn't exist, and sublime won't create the missing folder, so it errors.
You just need to make the spec/support folder , then sublime will save the file.
I also highly recommend installing the AdvancedNewFile plugin ( Video of it action thanks to Jeffrey Way and NetTuts+ ) , which you can grab straight from Package Control.
It creates files, parent folders if needed, and if you try to create a file that already exists, it opens it instead.
This can happen if you are trying to create the file within a directory that does not currently exist. For ex. I was unable to save
~/rails_projects/sample_app/app/views/shared/_error_messages.html.erb
via the "subl" command from the Terminal because I was missing /shared/ folder. Hope that helps.
so #knice almost had it, I ran into the same problem with permission when starting my first rails project on mavericks.
as mentioned if you run ls -l you'll see your folder / files listed with their permissions
I solved this by changing ownership recursively with the following command from outside my project directory
sudo chown -Rv <your_username> <your_path_and_foldername>
for example if you're in your folder in terminal you should cd .. and then
sudo chown -Rv username ruby_proj/
the -R is for recursive meaning it will apply to all files and folder contained within the folder you specified, and the v after just produces verbose output, showing you which folder and file permissions have been changed.
Hope that helps someone else.
I am setting up Rails+ffmpeg on Ubuntu and I keep getting
Errno::ENOENT
No such file or directory..
The setup is as follows:
/home/username/RailsApp
/home/username/videos/
I am trying to run ffmpeg to write to /home/username/videos and I used "/home/username/videos/" and "~/videos/" but no luck..
What am I missing?
"www-data" user is included in "username" group..
Rails app works fine otherwise..
Any input greatly appreciated!
Thanks!
Generally is good not to be dependent on local file system. Try following:
path_to_video = "#{Rails.root.to_s}/videos/video1.avi"
print File.exist?(path_to_video)
If you don't want to have videos in Rails/public just create a link with ln -s target link_name and on production server you should do it in similar way e.g. with capistrano.
Btw. what are the rights to videos? -rw-r--r--? and under wich user is running your webserver?
when I type the command
mkdir rails_projects
to follow along with a tutorial I am using on www.railstutorial.org I get this problem:
~ DUFF$ mkdir rails_projects
mkdir: rails_projects: Permission denied
Does anyone know what this is happening? I tried to quit terminal and come back, but that didn't work. I was thinking I may some how not have access to the current directory I am in, but I am not sure how to check that and I am the only user (that I am aware of on the computer). I looked around at the other threads but it seemed like they were not the same issue and most were PHP based.
I am not sure what commands I use to find out the directory I am currently in. Also, I am new to programming so I am not sure where these things reside on my system. Any help would be appreciated. You all were very helpful with my questions yesterday. I have seen a few posts saying you never need to use sudo and I should have access to create a directory, so I am not sure what is happening.
Again, thanks in advance.
What operating system are you using? If it's Linux/OS X, you can use the pwd command to list your current directory.
I would recommend you then switch directories to your user's home directory and start work there. You can do this with the cd ~
~ is simply a shortcut for the full path to the user's home directory, which, in OS X is generally /Users/username
I just started learning rails a week ago and everything worked until today. Now when I start the Ruby command prompt, it says:
The system cannot find the path specified.
# Under Rails Environment Configuration.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
---
The paths for ruby and rails show up correctly.
I'm using Windows Vista 32-bit. Any help would be greatly appreciated, thanks!
You've probably used "Ansicon" - a program to get the colors in windows prompt right. If you installed it permanently with -i parameter and consequently moved/deleted its directory, it would lead to this error. (I've just experienced it)
The solution is to renew the location of the ansicon data files or to remove the following registry entry:
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun
You can find more on this issue at http://carol-nichols.com/2011/03/17/the-system-cannot-find-the-path-specified/
Good luck!
I had the same problem in Windows 7 and solved it by adding Git/bin directory to the system path variable (found the answer here). Hope this helps someone!
None of the answers above helped me. My issue was whenever i typed rail -v it gave me the same error. I had to install rails, i used the following command:
gem install rails --no-document
you can check out the following installation steps to get around the error:
http://docs.railsbridge.org/installfest/windows