`binding.pry` вызывает` ArgumentError: не абсолютный дом` - PullRequest
0 голосов
/ 04 июня 2019

При каких условиях pry может завершиться с этой ошибкой?

ArgumentError: non-absolute home

код в точке отказа:

puts "ENV['HOME']: #{ENV['HOME']}"
binding.pry

трассировка стека:

ENV['HOME']: localhost:3000                                                     
rake aborted!                                                                   
ArgumentError: non-absolute home                                                
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/gems/pry-0.12.2/lib/pry/pry_class.rb:105:in `expand_path'
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/gems/pry-0.12.2/lib/pry/pry_class.rb:105:in `real_path_to'
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/gems/pry-0.12.2/lib/pry/pry_class.rb:100:in `block in rc_files_to_load'
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/gems/pry-0.12.2/lib/pry/pry_class.rb:100:in `map'
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/gems/pry-0.12.2/lib/pry/pry_class.rb:100:in `rc_files_to_load'
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/gems/pry-0.12.2/lib/pry/pry_class.rb:88:in `load_rc_files'
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/gems/pry-0.12.2/lib/pry/pry_class.rb:148:in `initial_session_setup'
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/gems/pry-0.12.2/lib/pry/pry_class.rb:184:in `start'
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/gems/pry-0.12.2/lib/pry/core_extensions.rb:43:in `pry'
/Users/bart_simpson/Projects/kewl_project/kewl_project/lib/tasks/kewl_project_tasks_helper.rb:104:in `block in import_energy_storage_facilities_from_state_task2'
/Users/bart_simpson/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/csv.rb:1764:in `each' 
/Users/bart_simpson/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/csv.rb:1142:in `block in foreach'
/Users/bart_simpson/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/csv.rb:1289:in `open' 
/Users/bart_simpson/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/csv.rb:1141:in `foreach'
/Users/bart_simpson/Projects/kewl_project/kewl_project/lib/tasks/kewl_project_tasks_helper.rb:100:in `import_energy_storage_facilities_from_state_task2'
/Users/bart_simpson/Projects/kewl_project/kewl_project/lib/tasks/kewl_project_tasks_helper.rb:69:in `import_energy_storage_facilities_via_state_task'
/Users/bart_simpson/Projects/kewl_project/kewl_project/lib/tasks/kewl_project.rake:215:in `block (2 levels) in <main>'
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/gems/rake-12.3.2/lib/rake/task.rb:273:in `block in execute'
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/gems/rake-12.3.2/lib/rake/task.rb:273:in `each'
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/gems/rake-12.3.2/lib/rake/task.rb:273:in `execute'
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/gems/rake-12.3.2/lib/rake/task.rb:214:in `block in invoke_with_call_chain'
/Users/bart_simpson/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/gems/rake-12.3.2/lib/rake/task.rb:194:in `invoke_with_call_chain'
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/gems/rake-12.3.2/lib/rake/task.rb:183:in `invoke'
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/gems/rake-12.3.2/lib/rake/application.rb:160:in `invoke_task'
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/gems/rake-12.3.2/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/gems/rake-12.3.2/lib/rake/application.rb:116:in `each'
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/gems/rake-12.3.2/lib/rake/application.rb:116:in `block in top_level'
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/gems/rake-12.3.2/lib/rake/application.rb:125:in `run_with_threads'
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/gems/rake-12.3.2/lib/rake/application.rb:110:in `top_level'
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/gems/rake-12.3.2/lib/rake/application.rb:83:in `block in run'
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/gems/rake-12.3.2/lib/rake/application.rb:186:in `standard_exception_handling'
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/gems/rake-12.3.2/lib/rake/application.rb:80:in `run'
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/bin/rake:23:in `load'     
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/bin/rake:23:in `<main>'   
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/bin/ruby_executable_hooks:24:in `eval'
/Users/bart_simpson/.rvm/gems/ruby-2.5.1@kewl_project/bin/ruby_executable_hooks:24:in `<main>'
Tasks: TOP => kewl_project:import_energy_storage_facilities                     

ОБНОВЛЕНИЕ

Я обнаружил, что если я выдаю binding.pry сразу после require 'pry' в верхней части модуля (т.е. не в пределахметод, но вне какой-либо области действия метода), тогда он работает, и ENV['HOME'] - это то, что мы ожидаем:

/Users/bart_simpson

Так что теперь вопрос: где ENV['HOME'] изменяется на localhost:3000 ??

1 Ответ

0 голосов
/ 05 июня 2019

ENV['HOME'] было переопределено.

Кто-то добавил ENV['HOME']='localhost:3000' к переменным среды нашего приложения. Плохо!

Извините, что потратил впустую время всех!

...