# Creating csv files from .dtx: blank line at top

I'm working on a .dtx project in which I might embed data in the .dtx to be written to a couple of .csv files. The problem I'm encountering is that a line feed character is inserted before the first line of output of each .csv. This shows up as a blank line at the beginning of the .csv. This potentially will cause problems when my package reads from the .csv unless I write an elaborate trapping routine (which I'm trying to avoid).

Is there a way to get the first line of actual data to be the first line of the .csv?

Here is an MWE of the .dtx:

% \iffalse meta-comment
% !TEX program  = pdfLaTeX
%<*internal>
\iffalse
%</internal>
----------------------------------------------------------------
A test file
----------------------------------------------------------------

This package is a test.
%<*internal>
\fi

\def\nameofplainTeX{plain}
\ifx\fmtname\nameofplainTeX\else
\expandafter\begingroup
\fi
%</internal>
%<*install>
\input docstrip.tex
\keepsilent
\preamble
----------------------------------------------------------------
A test file
----------------------------------------------------------------

\endpreamble
\postamble

Copyright (C) 2015 by test file

\endpostamble
\usedir{./}
\generate{
\file{\jobname.sty}{\from{\jobname.dtx}{package}}
}

%</install>
%<install>\endbatchfile
%<*internal>
\usedir{./}
\generate{
\file{\jobname.ins}{\from{\jobname.dtx}{install}}
}
\nopreamble\nopostamble
\usedir{./}
\nopreamble\nopostamble
\generate{\file{csvfirst.csv}{\from{\jobname.dtx}{csv1}}}
\nopreamble\nopostamble
\generate{\file{csvsecond.csv}{\from{\jobname.dtx}{csv2}}}

\ifx\fmtname\nameofplainTeX
\expandafter\endbatchfile
\else
\expandafter\endgroup
\fi
%</internal>
%
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{csvtesterstuff}[2015/08/28 v0.01 LaTeX package for incorporating csv data in dtx]
\RequirePackage{pythontex}
\RequirePackage{siunitx}
%</package>
%
%<*driver>
\documentclass{ltxdoc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{\jobname}
\usepackage[numbered]{hypdoc}
\usepackage{isotope}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
\DocInput{\jobname.dtx}
\end{document}
%
%</driver>
% \fi
%
%\GetFileInfo{\jobname.sty}
%
%\title{^^A
%  \textsf{csvtest} --- provides a test for csv inclusion\thanks{^^A
%    This file describes version \fileversion, last revised \filedate.^^A
%  }^^A
%}
%\author{^^A
%  testing\thanks{E-mail: testing}^^A
%}
%\date{Released \filedate}
%
%\maketitle
%
%\changes{v0.01}{2015/08/28}{First public release}
%
%    Testing the inclusion of csv data in a .dtx file.\par
%
%\DescribeMacro{\stub}
% This is a stub.
%~
%
%~
%
%\StopEventually{^^A
%    \PrintChanges
%    \PrintIndex
%}

% \iffalse
%<*package>
%<<pythoncode

\begin{pycode}
import sys
import fileinput
import csv
from subprocess import check_output

u2Mev=931.502
u2kev=u2Mev*1000.
Mev2u=1.0/u2Mev
kev2u=1.0/u2kev
u2kg=1.660539e-27
kg2u=1.0/u2kg

\end{pycode}
%pythoncode

%\begin{macro}{\stub}
%    \begin{macrocode}
\newcommand{\stub}{This is a stub.}
%    \end{macrocode}
%\end{macro}
%<<endinput
\endinput
%endinput
%</package>
%<*csv1>
bill,2,1,Bo,3.123
sally,3,2,Sa,4.323
%</csv1>
%
%<*csv2>
Hydrogen,H,1
Uranium,U,92
%</csv2>
% \fi
%\Finale


Any entirely blank line outside of guards will do this. You have

%\StopEventually{^^A
%    \PrintChanges
%    \PrintIndex
%}

% \iffalse
%<*package>
%<<pythoncode


which should be

%\StopEventually{^^A
%    \PrintChanges
%    \PrintIndex
%}
% \iffalse
%<*package>
%<<pythoncode


Make the change and your stray line will vanish.