Comments (24)
What's happening to trigger this? Are you starting the server or updating translations etc?
Also, this looks to be 1.9.1, not 1.9.2, is that correct?
from localeapp.
No, its 1.9.2. Ruby 1.9.2 uses the path of 1.9.1 for some backwards capability, its a bit strange.
It seems to happen when starting up the server.
from localeapp.
Can you try running bundle exec localeapp pull
before starting the server please
from localeapp.
Hm, running the app locally in production works fine...
from localeapp.
Seems my email reply is not arriving here at github, so i post it again here. It belongs before my previous message:
The server starts automatically on Heroku. But I will try recreating the issue here locally by running the app in production env.
from localeapp.
This seems to be related to the latest gem update we did, from the git repo master to 0.4.2. That is strange however, as the git repo was most likely identical to 0.4.2.
Could it have something with our app being on heroku and the filesystem not being persisted there?
Actually when I deploy to Heroku there is no log/localeapp.yml.
from localeapp.
First stab at integrating localeapp in an existing rails app (3.2.2 with ruby 1.9.2).
I am getting the same error in my local development, and I don't think that the problem is with reading the log file.
Playing around with the pry console, this is what I have found out.
In localeapp.rb
, around line 113:
def load_yaml(contents)
if defined? Psych
Psych.load(contents)
else
normalize_results(YAML.load(contents))
end
end
in this context, contents
is a string like this:
"--- \n:polled_at: 1333020322\n:updated_at: 1333020322\n"
and YAML.load(contents)
works fine, it returns a hash with the two key/value pairs, obviously the content of log/localeapp.yml
.
On the other hand, Psych.load(contents)
crashes, as if it expects a file name, rather than the content of the file (hence the 'no such file' error)
from localeapp.
This is puzzling, I'm seeing this :
ruby-1.9.2-p290 :001 > require 'psych'
=> true
ruby-1.9.2-p290 :002 > Psych.load "--- \n:polled_at: 1333020322\n:updated_at: 1333020322\n"
=> {:polled_at=>1333020322, :updated_at=>1333020322}
which is exactly as expected.
from localeapp.
Yeah, locally here it works also for me and looking at the code here I see that Psych.load indeed expects a yaml string, not a file. Possibly the Psych version I have locally varies from the one on heroku and the one giuseb uses.
from localeapp.
Yep! Can confirm this theory. On heroku Psych.load "--- \n:polled_at: 1333020322\n:updated_at: 1333020322\n" gives me the error.
from localeapp.
@ncri a stack trace would be useful!
from localeapp.
irb(main):001:0> Psych.load "--- \n:polled_at: 1333020322\n:updated_at: 1333020322\n"
LoadError: no such file to load -- ---
:polled_at: 1333020322
:updated_at: 1333020322
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:245:in `load'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:245:in `block in load'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:236:in `load_dependency'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:245:in `load'
from (irb):1
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.2/lib/rails/commands/console.rb:47:in `start'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.2/lib/rails/commands/console.rb:8:in `start'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.2/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
from localeapp.
Psych is part of ruby and it seems to have caused problems, supposedly fixed in more recent builds.
See for example: http://pivotallabs.com/users/mkocher/blog/articles/1692-yaml-psych-and-ruby-1-9-2-p180-here-there-be-dragons
@tigrish, I'm guessing the reason you see the correct behavior is that you are on ruby-1.9.2-p290
while I am on ruby-1.9.2-p180
.
@ncri, which ruby is your Heroku stack using?
from localeapp.
Heroku uses also 1.9.2p290, so that can't be the reason. I also opened this ticket: ruby/psych#55 See the comments there. I guess for me a quick and dirty fix might be to install the psych gem for heroku only. But I don't like running different code in production. @giuseb Does it work when you install the psych gem?
from localeapp.
After including gem 'psych'
in Gemfile, I am now getting the error below when starting the server.
I don't know if it's relevant, but I used brew install libyaml
in order to build the gem's native extensions.
Exiting
/Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:239:in `block in visit_Psych_Nodes_Alias': Unknown alias: errors_messages (Psych::BadAlias)
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:239:in `fetch'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:239:in `visit_Psych_Nodes_Alias'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/visitor.rb:15:in `visit'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/visitor.rb:5:in `accept'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:20:in `accept'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:257:in `block in revive_hash'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:251:in `each'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:251:in `each_slice'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:251:in `revive_hash'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:141:in `visit_Psych_Nodes_Mapping'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/visitor.rb:15:in `visit'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/visitor.rb:5:in `accept'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:20:in `accept'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:266:in `block in revive_hash'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:251:in `each'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:251:in `each_slice'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:251:in `revive_hash'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:141:in `visit_Psych_Nodes_Mapping'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/visitor.rb:15:in `visit'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/visitor.rb:5:in `accept'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:20:in `accept'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:266:in `block in revive_hash'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:251:in `each'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:251:in `each_slice'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:251:in `revive_hash'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:141:in `visit_Psych_Nodes_Mapping'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/visitor.rb:15:in `visit'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/visitor.rb:5:in `accept'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:20:in `accept'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:266:in `block in revive_hash'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:251:in `each'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:251:in `each_slice'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:251:in `revive_hash'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:141:in `visit_Psych_Nodes_Mapping'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/visitor.rb:15:in `visit'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/visitor.rb:5:in `accept'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:20:in `accept'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:266:in `block in revive_hash'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:251:in `each'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:251:in `each_slice'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:251:in `revive_hash'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:141:in `visit_Psych_Nodes_Mapping'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/visitor.rb:15:in `visit'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/visitor.rb:5:in `accept'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:20:in `accept'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:231:in `visit_Psych_Nodes_Document'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/visitor.rb:15:in `visit'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/visitor.rb:5:in `accept'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/visitors/to_ruby.rb:20:in `accept'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych/nodes/node.rb:35:in `to_ruby'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych.rb:128:in `load'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych.rb:297:in `block in load_file'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych.rb:297:in `open'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/psych-1.3.1/lib/psych.rb:297:in `load_file'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/i18n-0.6.0/lib/i18n/backend/base.rb:171:in `load_yml'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/i18n-0.6.0/lib/i18n/backend/base.rb:157:in `load_file'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/i18n-0.6.0/lib/i18n/backend/base.rb:15:in `block in load_translations'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/i18n-0.6.0/lib/i18n/backend/base.rb:15:in `each'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/i18n-0.6.0/lib/i18n/backend/base.rb:15:in `load_translations'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/i18n-0.6.0/lib/i18n/backend/simple.rb:57:in `init_translations'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/i18n-0.6.0/lib/i18n/backend/simple.rb:71:in `lookup'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/i18n-0.6.0/lib/i18n/backend/base.rb:26:in `translate'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/i18n-0.6.0/lib/i18n.rb:156:in `block in translate'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/i18n-0.6.0/lib/i18n.rb:152:in `catch'
from /Users/giuseppe/.rvm/gems/ruby-1.9.2-p180@quizzi/gems/i18n-0.6.0/lib/i18n.rb:152:in `translate'
snip
from localeapp.
#30 should explain and fix this issue. HAPPY FRIDAY! ❤️
from localeapp.
@tenderlove: Thanks a lot! ;-) I'm still wondering though, why Psych gets loaded locally for me but not on Heroku, using the same ruby version and patch level. It seems Heroku's ruby doesn't come with Psych for some reason. That would also explain that locally require 'psych' returns false, but LoadError: no such file to load -- psych on Heroku
from localeapp.
I normally let Heroku precompile my app's assets for me and I was getting some errors when pushing the code (sadly, the exact error message disappeared somewhere in the console buffer, but I am sure that the error was coming from log/localeapp.yml). I precompiled my assets locally and pushed the changes, my app was deployed, but I got ncri's error when opening the application.
So I found this issue and tried tenderlove's fix without precompiled assets. When I pushed to Heroku, I got this error:
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?
Tasks: TOP => environment
(See full trace by running task with --trace)
Precompiling assets failed, enabling runtime asset compilation
When I precompiled my assets locally, it worked fine. So the fix is definitely working but something is still breaking at Heroku's side. Everything works normally on my machine (Ruby 1.9.2, Rails 3.2.0).
(I wasn't sure if this should be posted as a new issue, so let me know if you think it's a separate problem)
from localeapp.
@svileng: This looks like you have a dependency on the database in your precompile task. Have you set config.assets.initialize_on_precompile = false in your application.rb?
from localeapp.
@ncri Thank you, good catch! This was commented out by mistake. Everything is working fine now.
from localeapp.
Just released localeapp v0.4.3 with @tenderlove's patch.
Closing this ticket for the time being.
from localeapp.
Does it mean when I use this patch locale will not use psych on heroku? How comes that in my local ruby psych is included, but not on Heroku? Anyone any ideas?
from localeapp.
@ncri that is correct, it will not use psych on heroku. I think bundler will attempt to activate psych (if it's available), then falls back to syck. You probably have psych installed on your local machine, and bundler enables it. Heroku does not have psych installed for 1.9.2, so the system falls back to syck.
You may want to request psych be installed for 1.9.2, but I think heroku has something in the works for 1.9.3 (not sure though).
/cc @hone
from localeapp.
Okay, thanks for the info tenderlove ;-) I might talk to the Heroku people about this...
from localeapp.
Related Issues (20)
- Problem pushing new translations? HOT 10
- Translations not updating in daemon -b mode, puma requires restart to pick up new translations HOT 5
- Incompatible with Ruby 2.4: dependency on json gem ~>1.8 HOT 6
- Localeapp pull not working HOT 1
- Uninitialized constant Rails HOT 6
- `config.reloading_environments = []` not working
- `localeapp pull` sometimes takes forever to reflect added translations. HOT 16
- localeapp.com does not redirect to www.localeapp.com HOT 2
- Leave `.env` alone
- Pull add unwanted line to en.yml HOT 3
- Deprecation Warning in Rails 6 initialization HOT 2
- Remove (or update) wiki page HOT 1
- Option to specify which locales to poll HOT 1
- Selective key pull fails HOT 1
- Excluding certain translations from `localeapp push` HOT 8
- Add Webhooks
- Add option to remove keys not used anymore HOT 1
- ruby 3.0 / rails 6.1 incompatibility issue HOT 3
- Broken with I18n >= 1.9.0 HOT 3
- Use the original filename instead of the locale
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from localeapp.