-
Notifications
You must be signed in to change notification settings - Fork 0
Diagnosing errors
-
If a
stataconserror is the result of a Stata do-file exiting with error, a.logfile will be saved, typically to the directory from which you are running statacons. Examine this.logfile to see if the error seems to be with the Stata code rather than withSConsorstataconsper se. -
Exit and re-start all instances of Stata, Python, Anaconda, etc.
-
Verify that all programs (ado-files and other) are up-to-date, that you are in fact using the ado-files that you think you are, and that Stata can find Python, SCons and pystatacons. In Stata:
sysdir
which statacons
python query
python which SCons
python which pystatacons
-
Because the mechanics of
stataconsare a bit complex (Stata calls Python, which loads SCons and pystatacons, then calls SCons, which then calls Stata in batch mode), it can be difficult to see exactly where an error is occurring. To attempt to isolate the problem:- Check that your code runs in Stata (
do code/dofile.doas usual from within Stata). - Check whether your code runs in Stata's batch mode from your terminal of choice (e.g.,
"C:\Program Files\Stata16\StataSE.exe" /e do "code/dofile.do"). - Look at the output of
statacons, show_configto see whetherstataconsis finding Stata properly, etc. If you obtain surprising results fromstatacons, show_config, examineconfig_local.iniandconfig_project.inito see if you are setting any variables incorrectly. - Run
sconsfrom a terminal. Conditional on arriving to this step without error, if you see an error here, it is likely related to SCons itself (e.g., the SConstruct script) rather thanstataconsper se. If you do not see an error in command-line scons, but the error persists when invokingstataconsfrom within Stata, then the error is related to either thestataconscommand or the way that Stata interacts with Python and SCons.
- Check that your code runs in Stata (
-
Run
debugging-checklist.doand inspect the output carefully.