Troubleshoot

Password for 'sudo'
Any time you use 'sudo' (the equivalent of running a command as an administrator in Windows) you will be asked to enter the password for robot which is maker (case-sensitive).

Error message: /usr/bin/env: 'python3 \r': No such file or directory
If you get that error message when you try to run your EV3 Python script on the EV3 from VS Code it probably means that the lines of code end with the wrong characters. They need to end with line feed (LF) characters but Windows PCs often put Carriage Return AND Line Feed (CRLF) characters at the end of lines. These are invisible characters, but you can tell which ones are being used by looking at the bottom right of the VS Code window. You need to see LF and not CRLF. If you see CRLF you should be able to change to LF by left-clicking where it says CRLF and then choosing LF. But that would probably only solve the problem for that one script. 

To solve the problem for all the scripts in the folder that you have open in VS Code, that folder should contain a folder called .vscode and inside that folder there should be at least these two files: launch.json and settings.json. This was explained in section 10 of the page on Setting up VS Code. If you double-click the settings.json file you should see at least these two lines:
    "files.eol": "\n",
    "ev3devBrowser.download.exclude": "{**/.*,LICENSE,README.md}"
You can also open the workspace settings by left-clicking the gear in the bottom left corner of the VS Code window and choosing 'Settings'. That will create the file settings.json if it does not already exist in your project folder. The first of those two lines above tells VS Code to use LF characters at the ends of lines (eol) for all the scripts in your project folder. On Windows PCs, VS Code uses CRLF by default but this setting in the settings.json file overrides the default setting. 

Having this line "files.eol": "\n", in a file called settings.json in a folder called .vscode in your project folder means the setting is a 'workspace setting' which only applies to your project folder (your workspace). If you want to make sure you never have this problem again it should be safe to move the line from the Workspace Settings area to the User Settings area. 'User Settings' apply all the time that VS Code is open, and not just for one particular folder.

Error Message: Failed to execute child process "/home/robot/???????.py" (Permission denied)
If you get this message it probably means you do not have the necessary 'shebang' line as the first line of the script that you are trying to run on the EV3. The first line (the 'shebang') must be exactly this:
#!/usr/bin/env python3

Case sensitivity
Perhaps the most common error made by Python beginners is to forget that Python is case-sensitive, so that is the first thing to check.

Mismatched parentheses
This may be the second most common cause of problems, and the Python error messages often don't identify clearly lines that have mismatched parentheses (for example 3 opening parentheses and only 2 closing parentheses). Mismatched parentheses and the errors they generate often make it appear that there is a problem later in the script when in fact the problem is the mismatched parentheses.

Internet Connectivity
If you are using VS Code with the EV3 extension and if you update your SD card from time to time by simply downloading the latest Stretch (not Jessie) image HERE and flashing that to your SD card then you should never need your EV3 to have a connection to the internet. Therefore you can ignore this section.

If you don't meet those conditions or you're an advanced user then you may sometimes need your EV3 to be connected to the internet, such as when you want to update the ev3dev and Python libraries. The sharing of the PC's internet connection by Windows can sometimes fail - you will then get error messages when you try to use the internet from the brick. You can also know that you do NOT have a connection to the internet if Brickman tells you you are 'Connected'!! When the brick is connected to the internet, Brickman's networking page will say you are 'Online' rather than 'Connected'. Rather confusingly, 'Connected' means the brick is connected to the PC but NOT connected to the internet i.e. not 'online'. If you need to regain an internet connection from the brick you can try this:
  1. go to Control Panel > Network and Internet > Network connections. There you should see your internet connection and your connection to the EV3 and perhaps also other connections.
  2. Right-click the internet connection and choose Properties.
  3. In the Ethernet properties dialog box, choose the sharing tab.
  4. Turn off 'Allow other users to connect through this computer's internet connection' and press OK.
  5. Again right-click the internet connection and choose Properties.
  6. In the Ethernet properties dialog box, choose the sharing tab.
  7. Turn on 'Allow other users to connect through this computer's internet connection' and press OK.
  8. On the brick, within the Brickman interface, open Wireless and Networks. If you see Status: Online that should mean your brick is connected to the internet and that you can ignore the following instructions.
  9. If you see Status: Connected that means you ARE connected to the PC but are NOT connected to the internet and you should then open 'All Network Connections'. There may be more than one connection listed.
  10. Open the connection that you want to use to connect to the internet and choose the disconnect option if available.
  11. Once the Status is given as Disconnected choose the Connect option and you should see Status: Online which means the brick now has an internet connection.

LCD screen
If you are using VS Code with the EV3 extension then you can ignore this paragraph. Using Brickman to run scripts that use LCD screen is straightforward, but if you want to run the same scripts from SSH you need to carry out a few extra steps that are described at the bottom of this page.

Upgrade
If you are having lots of problems and you think it may be because your libraries are very out of date then you might want to upgrade them all. This should not be taken lightly because it may cause some of your programs to stop working because ev3dev is still being finalised and changes to ev3dev may cause your Python commands to fail. If you want to upgrade all your ev3dev libraries then the best way is just to download the latest Stretch (not Jessie) image HERE, flash it to your SD card and start using the new image. Flashing a new image to the card means you will lose all your scripts on the card but that should not be a problem because they are just copies of scripts that you have on your PC. To use my tutorial scripts you will need to download the 'sounds' and 'pics' folders to the card again, as explained elsewhere.
Comments