# Configuring an arara rule of sagetex on Windows 10

This question has been cross-posted on tex.sx here https://tex[dot]stackexchange[dot]com/q/557131/2288 (https://tex[dot]stackexchange[dot]com...).

When using the following `sagetex.yaml`

arara rule

```
!config
# SageTeX-Rule for arara.
identifier: sagetex
name: SageTeX
authors:
- TeXnician (Author)
- cis (Idea)
arguments: []
commands:
- name: A SageTeX Rule for arara
command: >
@{
pathToBashExecutive = "C:\\Program Files\\SageMath 9.1\\runtime\\bin\\bash";
pathToSageStartfile = "C:/Program Files/SageMath 9.1/runtime/opt/sagemath-9.1/sage";
pathOfCurrentWorkingFolder = currentFile().getParent();
theWindowsCommand = getCommand(pathToBashExecutive, "-l", pathToSageStartfile, "-c", "os.chdir('" + pathOfCurrentWorkingFolder + "'); load('" + getBasename(currentFile()) + ".sagetex.sage')");
return isWindows(theWindowsCommand, getCommand("sage", getBasename(reference) + ".sagetex.sage"));
}
```

to compile the following document

```
% arara: lualatex
% arara: sagetex
% arara: lualatex
\documentclass{article}
\usepackage{sagetex}
\begin{document}
Using Sage\TeX, one can use Sage to compute things and put them into your \LaTeX{} document. For example, there are
$\sage{number_of_partitions(1269)}$ integer partitions of $1269$.
You don't need to compute the number yourself, or even cut and paste it from somewhere.
Here's some Sage code:
\begin{sageblock}
f(x) = exp(x) * sin(2*x)
\end{sageblock}
The second derivative of $f$ is
\[
\frac{\mathrm{d}^{2}}{\mathrm{d}x^{2}} \sage{f(x)} =
\sage{diff(f, x, 2)(x)}.
\]
Here's a plot of $f$ from $-1$ to $1$:
\sageplot{plot(f, -1, 1)}
\end{document}
```

I get this error

SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

So, what should be changed in both the arara rule and, consequently, the following command to make everything work?

```
"C:\Program Files\SageMath 9.1\runtime\bin\bash" -l "C:/Program Files/SageMath 9.1/runtime/opt/sagemath-9.1/sage" -c "os.chdir('C:\Users\Diaa\Desktop\Test'); load('testsagetex.sagetex.sage')"
```

A minimal text in the

`document`

block, that still produces the error, may better isolate its reason and lead to the (needed escape sequence for the) solution...@dan_fulea The same document can be compiled successfully without errors from the sage shell. So, apparently, the command prompt syntax needs some fixes.

Yes, i understand, the problem is that the error may highly depend on a given installation and configuration of many pieces of stuff. So we possibly have no chance to detect the error, in such a situation it is best to try yourself to isolate as good as possible the error. Just cut the document block into pieces till the error is eliminated. Then give us that line producing the error.