Technology Programming

Mechanize Error: "Unknown cookie jar file format"

The error "Unknown cookie jar file format" can be raised in one of two places, in Mechanize::CookieJar#save_as and Mechanize::CookieJar#load.

What Causes the Error?


Both of these methods take two arguments, a filename and a format. The format should be either the symbol :yaml or :cookiestxt. The :yaml argument obviously instructs Mechanize to save the cookie jar in YAML format, and :cookiestxt to save in Mozilla-compatible cookies.txt format.


If the format argument is anything but these two symbols, it will raise the "Unknown cookie jar file format" error.

For instance, this will cause the error to be raised.

agent.cookie_jar.save_as('some_file', :unknownformat)

How do I Fix the Error?


Pass either :yaml or :cookiestxt as the second parameter to Mechanize::CookieJar#save_as or Mechanize::CookieJar#load. Alternatively, pass no second argument to the methods, as the default for the second argument is :yaml.

The following are valid ways to call Mechanize::CookieJar#save_as or Mechanize::CookieJar#load.

agent.cookie_jar.save_as('cookies.yaml')agent.cookie_jar.save_as('cookies.yaml', :yaml)agent.cookie_jar.save_as('cookies.txt', :cookiestxt)agent.cookie_jar.load('cookies.yaml')agent.cookie_jar.load('cookies.yaml', :yaml)agent.cookie_jar.load('cookies.txt', :cookiestxt)

Related posts "Technology : Programming"

Brochure Design And Its Budget

Programming

Website designing delhi-web design services India-Website Development Company India

Programming

The Secrets and techniques Rob Fore Won't Tell you!

Programming

Where Do You Get Podcasting Ideas?

Programming

Avoid Hacking With The Help of WordPress Development Company

Programming

Sirius Radio - All You At Any Time Wished to Know

Programming

How to Use a Check Box to Filter a List

Programming

Get professional help from website development Dublin- promote business growth

Programming

PHP Shopping Carts

Programming

Leave a Comment