larsch/ocra

http-cookie error when running script after compiling.

Closed this issue · 2 comments

After using ocra to create exe file I get the following errors during the process, when it tries to send a post request. The request works when running main.rb but not main.exe

The error is:
can't resolve constant AbstractStore; failed to load http/cookie_jar/abstract_store (NameError)

C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/lib/ruby/gems/2.2.0/gems/http-cookie-1.0.3/lib/http/cookie_jar.rb:20:in rescue in const_missing': can't resolve constant AbstractStore; failed to load http/cookie_jar/abstract_store (NameError) from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/lib/ruby/gems/2.2.0/gems/http-cookie-1.0.3/lib/http/cookie_jar.rb:17:in const_missing'
from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/lib/ruby/gems/2.2.0/gems/http-cookie-1.0.3/lib/http/cookie_jar.rb:74:in initialize' from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/lib/ruby/gems/2.2.0/gems/rest-client-2.0.2-x64-mingw32/lib/restclient/request.rb:321:in new'
from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/lib/ruby/gems/2.2.0/gems/rest-client-```
2.0.2-x64-mingw32/lib/restclient/request.rb:321:in process_cookie_args!' from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/lib/ruby/gems/2.2.0/gems/rest-client-2.0.2-x64-mingw32/lib/restclient/request.rb:75:in initialize'
from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/lib/ruby/gems/2.2.0/gems/rest-client-2.0.2-x64-mingw32/lib/restclient/request.rb:52:in `new'
from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/lib/ruby/gems/2.2.0/gems/rest-client-2.0.2-x64-mingw32/lib/restclient/request.rb:52:in `execute'
from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/lib/ruby/gems/2.2.0/gems/rest-client-2.0.2-x64-mingw32/lib/restclient.rb:71:in `post'
from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/src/main.rb:46:in `block in upload_file'
from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/src/main.rb:36:in `open'
from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/src/main.rb:36:in `upload_file'
from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/src/main.rb:81:in `handle_file'
from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/src/main.rb:134:in `block in handle_dir'
from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/src/main.rb:112:in `each'
from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/src/main.rb:112:in `handle_dir'
from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/src/main.rb:131:in `block in handle_dir'
from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/src/main.rb:112:in `each'
from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/src/main.rb:112:in `handle_dir'
from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/src/main.rb:163:in `initialize'
from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/src/main.rb:122:in `new'
from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/src/main.rb:122:in `block in handle_dir'
from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/src/main.rb:112:in `each'
from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/src/main.rb:112:in `handle_dir'
from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/src/main.rb:131:in `block in handle_dir'
from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/src/main.rb:112:in `each'
from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/src/main.rb:112:in `handle_dir'
from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/src/main.rb:18:in `initialize'
from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/src/main.rb:174:in `new'
from C:/Users/Gihzah/AppData/Local/Temp/ocr9582.tmp/src/main.rb:174:in `

'

Running on windows 10.

PS C:\Users\Gihzah\Desktop\job-migration> ruby --version
ruby 2.2.6p396 (2016-11-15 revision 56800) [x64-mingw32]

PS C:\Users\Gihzah\Desktop\job-migration> gem list

*** LOCAL GEMS ***

bigdecimal (1.2.6)
bundler (1.15.4)
domain_name (0.5.20170404)
faraday (0.13.1)
ffi (1.9.18 x64-mingw32)
http-cookie (1.0.3)
io-console (0.4.3)
json (1.8.1)
mime-types (3.1)
mime-types-data (3.2016.0521)
minitest (5.4.3)
multipart-post (2.0.0)
netrc (0.11.0)
ocra (1.3.9)
power_assert (0.2.2)
psych (2.0.8)
rake (10.4.2)
rb2exe (0.3.0)
rdoc (4.2.0)
rest-client (2.0.2 x64-mingw32)
test-unit (3.0.8)
unf (0.1.4)
unf_ext (0.0.7.4 x64-mingw32)

I'm having the exact same issue

I figured it out. The script checks for some condition and then upload files to a server. I didn't want to actually upload anything so no files had to be uploaded while creating the script. I guess some packages aren't loaded when that happens and so they're not loaded into the executable. Making sure the script actually uploaded files during the creation of the exe fixed it.