Appeal from a judgment of the County Court of Albany County (Clyne, J.), entered November 9,1981, which dismissed a petition for a writ of habeas corpus after a hearing. Petitioner was convicted on September 24,1980 of criminal possession of a forged instrument in the second degree and *905sentenced as a persistent felon to an indeterminate term of 15 years to life. An appeal was immediately filed but has not yet been perfected. On July 20,1981, petitioner applied for a writ of habeas corpus. As justification for the issuance of a writ, defendant contended that the trial court had improperly ordered him to produce a handwriting sample during trial and that he was incorrectly determined to be a persistent felony offender. Petitioner’s application was dismissed following a hearing, and the instant appeal ensued. While an appeal is pending, a writ of habeas corpus is available only where considerations of practicality and necessity so dictate (People ex rel. Keitt v McMann, 18 NY2d 257, 262). The writ does not serve as a substitute for an appeal where, as here, all that is alleged are errors occurring at trial. Since these errors may be directly reviewed on the pending appeal and there is no compelling reason to separately examine them in this proceeding {People ex rel. Palmer v LeFevre, 72 AD2d 618), the judgment dismissing the petition should be affirmed. Judgment affirmed, without costs. Mahoney, P. J., Sweeney, Yesawich, Jr., Weiss and Levine, JJ., concur.