Skip to content

Common errors

rpguiteras edited this page Feb 3, 2026 · 13 revisions

Contribute common errors with diagnosis and treatment here.

error with file access when working on Dropbox

If you are using statacons within a Dropbox folder, Dropbox may briefly "lock" temporary or helper files that statacons creates (e.g., .txt, .sig, .do, .log). If statacons then needs to rewrite or add to this file, you may get an error.

The easiest workaround is to pause dropbox while you are working.

Longer-term solution - use python or SCons equivalents of shell pssuspend Dropbox and shell pssuspend -r Dropbox to pause dropbox during a build

Examples:

Error when computing dta-signature: C:\Users\rpguiter\Dropbox\f2e\out\data\project-village-IDs.dta: 
 [WinError 32] The process cannot access the file because it is being used by another process: 'sig-21321d80.txt'
Error when computing dta-signature: C:\Users\rpguiter\Dropbox\f2e\out\data\project-village-IDs.dta: 
 [WinError 32] The process cannot access the file because it is being used by another process: 'stata-21eaf7f4.log'

Error when computing dta-signature

There was a bug in early versions of complete_datasignature.ado that caused errors when data labels or notes included double-quotes.

Update complete_datasignature.ado:

net install statacons, from(https://raw.github.com/bquistorff/statacons/main/) force replace

If you have statacons and complete_datasignature installed in multiple locations, you may need to update both the "local" and "default" locations. The explanation is a bit complex, but essentially the problem is that when Python opens Stata for the purpose of creating file signatures, it may not see a local profile.do directing it to the local version of complete_datasignature.

File conflicts (Error 608)

scons or statacons may fail if you do not have write access to a file. One way for this to happen is if you have been working directly in Stata and Stata still has a file open.

Stata screen output:

Running: "C:\Program Files\Stata16\StataMP-64.exe" /e do "code\basicProgramEffects-Lin-AllVill-groupLevel-tabfig.do".
  Starting in hidden desktop (pid=79904).
scons: *** [output\tab\tex\grSh_r5HygOwn_Lin_AllVill_wtd.tex] Error 608
scons: building terminated because of errors.
Error from Python: 2
r(7103);

log-file:

file W:\bd_sanitation_social\analysis\temp/basicProgramEffects-Lin-AllVill-groupLevel-tabfig-TEMP.smcl
    cannot be modified or erased; likely cause is read-only directory or file
r(608);

end of do-file
r(608);

Solution: instruct Stata to close the relevant files (e.g., log close _all or file close _all), if this fails exit and restart Stata.

. log close _all
      name:  local_log
       log:  w:\BD_Sanitation_Social\analysis\temp/basicProgramEffects-Lin-AllVill-groupLevel-tabfig-TEMP.smcl
  log type:  smcl
 closed on:  27 May 2022, 12:18:50

do-files take much longer than expected

(Windows only) Check that you have installed the Python package pywin32. To install, open the relevant command prompt (e.g., Powershell, Anaconda Powershell Prompt):

pip install pywin32

You may have to run the terminal app in Administrator mode.

deprecation warnings

If you get a warning message such as

C:\ado\plus/py/runscons.py:40: DeprecationWarning: pkg_resources is deprecated as an API. 
See https://setuptools.pypa.io/en/latest/pkg_resources.html
  from pkg_resources import packaging

be sure you have updated to the latest version of statacons, including the .py modules:

net install statacons, from(https://raw.github.com/bquistorff/statacons/main/) force replace

statacons not auto-finding Stata executable

We have tried to write statacons so that it can find Stata's executable for a variety of installation setups. However, if you have Stata installed in an unusual place or along a path we have not covered, you will get an error like this:

. statacons, show_config
scons: Reading SConscript files ...
Can't find Stata from config or defaults
Current config:
KeyError: 'STATABATCHCOM':
  File "C:\Users\rpguiter\work\BGD_San_Struc\SConstruct", line 4:
    env = pystatacons.init_env()
  File "C:\Users\rpguiter\AppData\Local\miniconda3\Lib\site-packages\pystatacons\stata_utils.py", li
> ne 536:
    print("Stata batch found automatically: " + env['STATABATCHCOM'])
  File "C:\Users\rpguiter\AppData\Local\miniconda3\Lib\site-packages\SCons\Environment.py", line 603
> :
    return self._dict[key]
Error from Python: 2
r(7103);

This occured because I had Stata installed in a directory path we had not anticipated.

. di "`c(sysdir_stata)'"
C:\Program Files\StataNow19/

To fix this problem, I edited stata_exe in config_local.ini as follows

stata_exe: "C:/Program Files/StataNow19/StataMP-64.exe"

This specific problem of not finding StataNow has been addressed in v3.0.4 (released 2025-11-11) but still provides a useful example of what can go wrong when statacons is not able to find your Stata .exe automatically.

UnicodeDecodeError

If your dataset contains non-unicode characters (either in the values or labels), you may get a UnicodeDecodeError from scons. Note: this may occur even though complete_datasignature returns a valid sig.

Workaround (unsatisfactory): get rid of non-unicode characters.

  File "C:\Users\rpguiter\AppData\Local\miniconda3\Lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
           ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 1314: character maps to <undefined>

Clone this wiki locally