OSWIN error when trying to run getting-started-with-python-algorand-sdk-and-django/ tutorial and try to add initial funds to an account

This is the error I’m getting when I try to add initial funds to a standalone account. I’ve tried cleaning and restarting the sandbox. I’ve tested in Git Bash that sandbox is successfully able to transfer amounts between the funding addresses in testnet.

Any clues what’s going wrong here please?

Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/initial-funds/ZUCPYVE26JQCGRPIIBSWT4XAWBDPKWLYBZYEI3EUILIBWEOGNMCADOUF6U/

Django Version: 4.0.1
Python Version: 3.10.0
Installed Applications:
['mainapp.apps.MainappConfig',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']



Traceback (most recent call last):
  File "C:\Users\64275\Documents\GitHub\algorand\algovenv\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
    response = get_response(request)
  File "C:\Users\64275\Documents\GitHub\algorand\algovenv\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "C:\Users\64275\Documents\GitHub\algorand\algodjango\mainapp\views.py", line 144, in initial_funds
    cli_passphrase_for_account(sender),
  File "C:\Users\64275\Documents\GitHub\algorand\algodjango\mainapp\helpers.py", line 41, in cli_passphrase_for_account
    process = _call_sandbox_command("goal", "account", "export", "-a", address)
  File "C:\Users\64275\Documents\GitHub\algorand\algodjango\mainapp\helpers.py", line 20, in _call_sandbox_command
    return subprocess.Popen(
  File "C:\Python310\lib\subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Python310\lib\subprocess.py", line 1435, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,

Exception Type: OSError at /initial-funds/ZUCPYVE26JQCGRPIIBSWT4XAWBDPKWLYBZYEI3EUILIBWEOGNMCADOUF6U/
Exception Value: [WinError 193] %1 is not a valid Win32 application

It looks to me like your Django application is calling sandbox (GitHub - algorand/sandbox: Algorand node sandbox). Sandbox is not working directly on Windows and is not a WIN32 program. It might be best to use WSL 2 with Ubuntu or to remove all parts that explicitly call sandbox.

For reference, I see you’re following Getting started with Python Algorand SDK and Django | Algorand Developer Portal which indeed requires you to run a real Linux / macOS, and will not work directly on Windows without WSL 2.

PS: I’ve changed your post to write the error between triple backquotes ``` to improve presentation

1 Like