syntax-error

"Cannot find the path specified" when setting up patent crawler

"Cannot find the path specified" when setting up patent crawler Question: I am trying to set up the wenyalintw patent scraper. I got everything installed. I then go to execute the command cd src main.py and it tells me the system cannot find the path specified. I tried changing it to cd src "path to …

Total answers: 1

python exec() raises SyntaxError exception when passing an object inside the string argument

python exec() raises SyntaxError exception when passing an object inside the string argument Question: So I am currently trying to deploy my smart contract using a brownie script as shown in the code below: from brownie import accounts, network import sys sys.path.append("../") import globalVars def main(): import_str = "from {0} import {1}".format("brownie", globalVars.contractName) exec(import_str) network.connect(‘development’) …

Total answers: 1

Why is not letting me call this async function with await?

Why I'm unable to call this async function with await? Question: This is the web scraping problem that I have encountered that I don’t know how to fix. I want to call the async function scrape_session, but I cannot call it in the main file, and it gives me the error: error: "await" allowed only …

Total answers: 1

Indentation Error from main() in terminal

Indentation Error from main() in terminal Question: I’m new to using the main() part in Python3. Error thrown: python3 Artificial_snake_anti_venom.py File "Artificial_snake_anti_venom.py", line 67 def main(): snake_families = get_all_snake_families() all_antivenoms = create_all_antivenoms(snake_families) save_antivenoms_file(all_antivenoms.txt) show_user_message() if __name__ == "__main__": ^ SyntaxError: invalid syntax Code: #!/usr/bin/python # Creating Synthetic Snake Antivenom import random # Create a function …

Total answers: 1

Django: TemplateSyntaxError – Could not parse the remainder

Django: TemplateSyntaxError – Could not parse the remainder Question: Exception Value: Could not parse the remainder: ‘[‘image/jpeg’,’ from ‘[‘image/jpeg’,’ Why am I getting this TemplateSyntaxError for the code below? {% for file in resource.files.all %} {% if file.file.content_type|lower in [‘image/jpeg’, ‘image/png’, ‘image/gif’] %} <a class="resource-image" title="{{ file.id }}" href="{{ file.file.url }}"> <img width="100%" src="{{ file.file.url …

Total answers: 1

Syntax error in dictionary with multiple values in a single key

Syntax error in dictionary with multiple values in a single key Question: I am learning about dictionaries in Python and creating multiple values inside a single key. I have followed his instructions (from 2016) to a T, and even compared our code 1 to 1 and it is exact – yet mine yields a syntax …

Total answers: 2

python script opening multiple terminals, but only executing command in one

python script opening multiple terminals, but only executing command in one Question: I’d like my script to open 3 terminals and execute different commands in each, but all it does is run an nmap scan in the original terminal and opens 3 blank terminals. import subprocess TARGET_IP_ADDRESS = "IPHERE" terminal_windows = [] for i in …

Total answers: 1

SyntaxError: invalid non-printable character U+00A0 in python

SyntaxError: invalid non-printable character U+00A0 in python Question: I’m getting the error: SyntaxError: invalid non-printable character U+00A0 When I’m running the code below: # coding=utf-8 from PIL import Image   img = Image.open("img.png") I have tried to load different images with different formats (png, jpg, jpeg). I have tried using different versions of the Pillow …

Total answers: 1

AttributeError: 'Robot' object has no attribute 'introduce_self'

AttributeError: 'Robot' object has no attribute 'introduce_self' Question: I’m a beginner in class & objects and was wondering why the line r2.introduce_self had an attribute error with an object that doesn’t have an attribute. class Robot: def __init__(self, rname, rcolor, rweight): self.name = rname self.color = rcolor self.weight = rweight def introduce_self(self): print("my name is …

Total answers: 2