Problem with migratiion from blogger

I have successfully create a jekyll site hosted on github. When I try to migrate my contend from blogger I stack on an error. I download the file from blogger and I procceed with this code:

Blockquote

ruby -r rubygems -e ‘require “jekyll-import”;
JekyllImport::Importers::Blogger.run({
“source” => “/_import/blog-03-22-2021.xml”,
“no-blogger-info” => false,
“replace-internal-link” => false,
})’

Blockquote

When I hit enter the following error occur:

Blockquote
unknown regexp options - blg
… => /_import/blog-03-22-2021.xml,

Blockquote

Do you have any suggestion?
Thank you

What version of Ruby are you using? Jekyll isn’t compatible with Ruby 3 yet.

1 Like

Thank you for the reply.
I am using 2.7.2. I try many times and with different variations with the location of the file, but, with the same results.

Is there anything more to the error message? For example, a Traceback stack? File and line number for the error?

Also, could you use Markdown code-blocks for anything copied from the terminal – it just makes it easier to read and copy-paste. Here’s an example:

```
this is a code block
```
1 Like

No, I don’t see any other problem on the terminal.
The full code I use is


ruby -r rubygems -e ‘require “jekyll-import”;
JekyllImport::Importers::Blogger.run({
“source” => “/_import/blog-03-22-2021.xml”,
“no-blogger-info” => false,
“replace-internal-link” => false,
})’


and the only error that comes out is


-e:3: unknown regexp options - blg
… => /_import/blog-03-22-2021.xml,


Thanks. The full error message indicates that the problem is on line 3 of the script (-e:3). It looks like Ruby is interpreting part of the source path as a regular expression, but this would only happen if the source path wasn’t quoted.

Double-check that you have plain double-quotes around the source path (not single-quotes, fancy-quotes, etc). Without quoting, Ruby will interpret the /_import/ as a regular expression. Line 3 should be:

"source" => "/_import/blog-03-22-2021.xml",
1 Like

Tnank you for your reply. It seems to come with the same error message. I try many times with the double -quotes but alla the time the same error


ruby -r rubygems -e ‘require “jekyll-import”;
JekyllImport::Importers::Blogger.run({
“source” => “/_import/blog-03-22-2021.xml”,
“no-blogger-info” => false,
“replace-internal-link” => false,
})’

-e:3: unknown regexp options - blg
source=>/_import/blog-03-22-2021.xml,


I see on git gist a script for migration


Migrate your blogger blog posts to jekyll. (github.com)


do you think I can use it, and if yes how I can use it on my blog?

Thank you again for your time

The comments at the bottom of that Migrate script say it is out of date and point to the Blogger importer you’re trying to use, so I don’t think it will work.

Could you please paste your command inside a fenced code-block, so we can see exactly what characters are used for quoting? If you paste the command as plain text, then all the quotes are converted to “fancy quotes” (i.e. asymmetric left and right quotes) which cannot be used on the command line.

A fenced code-block is build by placing a line with a triple-backquote (```) before and after the pasted command. Start with:

```
<paste code here>
```

And then copy and paste your command where indicated.

1 Like

Another test to try is to copy and paste the command directly from the Jekyll Blogger import page and run it. It should produce a file-not-found error as below. If you see a different error, then there is a problem:

ruby -r rubygems -e 'require "jekyll-import";
    JekyllImport::Importers::Blogger.run({
      "source"                => "/path/to/blog-MM-DD-YYYY.xml",
      "no-blogger-info"       => false, # not to leave blogger-URL info (id and old URL) in the front matter
      "replace-internal-link" => false, # replace internal links using the post_url liquid tag.
    })'
Traceback (most recent call last):
	2: from -e:2:in `<main>'
	1: from /usr/local/lib/ruby/gems/2.7.0/gems/jekyll-import-0.20.0/lib/jekyll-import/importer.rb:24:in `run'
/usr/local/lib/ruby/gems/2.7.0/gems/jekyll-import-0.20.0/lib/jekyll-import/importers/blogger.rb:17:in `validate': No such file or directory - File not found: /path/to/blog-MM-DD-YYYY.xml (Errno::ENOENT)
1 Like

I try to run the command from jekyll and I get this error

-e:3: unknown regexp option - t
...urce                => /path/to/blog-MM-DD-YYYY.xml,

Ok, my exact code I try is this, with the following error

ruby -r rubygems -e 'require "jekyll-import";
    JekyllImport::Importers::Blogger.run({
      "source"                => "/_import/blog-03-22-2021.xml",
      "no-blogger-info"       => false, 
      "replace-internal-link" => false, 
    })'
-e:3: unknown regexp options - blg
...               => /_import/blog-03-22-2021.xml,

Very odd. When I copy and paste your code I get the expected file-not-found error.

Here’s a quick experiment. These two command just print the path. Do you get the same or different results: (note that % is the shell prompt):

% ruby -e 'p "/_import/blog-03-22-2021.xml"' 
"/_import/blog-03-22-2021.xml"

% ruby -e 'p /_import/blog-03-22-2021.xml' 
-e:1: unknown regexp options - blg
p /_import/blog-03-22-2021.xml
1 Like

Hello, with both commands I get the same error

#1

ruby -e 'p "/_import/blog-03-22-2021.xml"'
-e:1: unknown regexp options - blg
p /_import/blog-03-22-2021.xml

#2

ruby -e 'p /_import/blog-03-22-2021.xml'
-e:1: unknown regexp options - blg
p /_import/blog-03-22-2021.xml

Thanks, so somehow the command is getting garbled when pasted. What OS and shell are you using? I’m testing with macOS 11 and zsh, although any unix and sh-compatible shell should work.

1 Like

Thank you. I am using windows10 and visual studio code

Also I try to run the command (only the first line) via cmd with ruby, there I get a diffrent error

 -r rubygems -e 'require "jekyll-import";

Traceback (most recent call last):
        2: from -e:1:in `<main>'
        1: from D:/programs/Ruby27-x64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
D:/programs/Ruby27-x64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require': cannot load such file -- jekyll-import (LoadError)

Great, the commands are meant to be run on the command line. I’m not sure what VS-Code is doing.

To use the converter script, you’ll need the jekyll-import gem. Install it with the command:

gem install jekyll-import

Then try running the conversion command again.

1 Like

Hello again and thank you. So I run the script successfully and then again I run the conversion.
On the command line I get the folowing:

ruby -r rubygems -e 'require "jekyll-import";
    **"JekyllImport::Importers::Blogger.run"**({    -----  here i get the message: syntax of file,catalog name or tag is false
      "source"                => "/blog-03-22-2021.xml", ---- here I get the message: "source"' is not recognized as an internal or external command,operable program or batch file.
      "no-blogger-info"       => false, ---- here I get the message: "source"' is not recognized as an internal or external command,operable program or batch file.
      "replace-internal-link" => false, ---- here I get the message: "source"' is not recognized as an internal or external command,operable program or batch file.
    })'

 

Possibly the Windows command shell can’t handle line-breaks? Maybe try running the conversion script on one long line. I.e.:

ruby -r rubygems -e 'require "jekyll-import"; JekyllImport::Importers::Blogger.run({ "source" => "/_import/blog-03-22-2021.xml", "no-blogger-info" => false, "replace-internal-link" => false, })'
1 Like

I really don’t know, I try on cmd and vs code. I try it also in one line, on cmd

ruby -r rubygems -e 'require "jekyll-import"; JekyllImport::Importers::Blogger.run({ "source" => "/_import/blog-03-22-2021.xml", "no-blogger-info" => false, "replace-internal-link" => false, })'
-e:1: syntax error, unexpected '=', expecting =>
...rters::Blogger.run({ "source" =, "no-blogger-info" =, "repla...
-e:1: syntax error, unexpected '=', expecting end-of-input
..."source" =, "no-blogger-info" =, "replace-internal-link" =, ...

on vs code

 ruby -r rubygems -e 'require "jekyll-import"; JekyllImport::Importers::Blogger.run({ "source" => "/_import/blog-03-22-2021.xml", "no-blogger-info" => false, "replace-internal-link" => false, })'
-e:1: unknown regexp options - blg
...r.run({ source => /_import/blog-03-22-2021.xml, no-blogger-i...