I'm trying to print the value of str from the pycode environment, however, it doesn't work. Interestingly \pyc{print(str)} works. Can someone please show me how to get the pycode environment to work.
\documentclass{article}
\usepackage{pythontex}
\newcommand{\setstring}[1]{\pyc{str="#1"}}
\begin{document}
\setstring{hello pluto}
The value of str is:
\begin{pycode}
print(str)
\end{pycode}
\end{document}