Unable to execute Python command in cmd due to syntax error

I am encountering issues while using node-gyp configure for a frontend project on Windows 10.

The error message is as follows:

$ node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="81efefe5e4ace6f8f1c1b2afb9afb1">[email protected]</a>
gyp info using <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c7a9a8a3a287f6f7e9f5f7e9f6">[email protected]</a> | win32 | x64
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\xetra11\AppData\Local\Programs\Python\Python37\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
...truncated for brevity...

I attempted to replicate the python issue:

$ python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
  File "<string>", line 1
    import
         ^
SyntaxError: invalid syntax
Unable to initialize device PRN

The Python version being used is 3.7.1

Any suggestions on how to resolve this? Should I consider downgrading my Python version or exploring other solutions?

Answer №1

Python 3.x versions require the use of parentheses when using the print function with text or variables.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The request made in Node.js encountered an error with a status code of

I can't figure out why I keep receiving the status code 403 when running this code. My objective is to authenticate with Instagram. var request = require("request"); var options = { url:'https://www.instagram.com/accounts/login/', ...

Developed specifically for asynchronous messaging, this Node.js REST API wrapper simplifies

When working with an event-driven microservice architecture that utilizes asynchronous messaging, what options exist for creating a 'synchronous' REST API wrapper where requests wait for response events before providing a result to the client? F ...

The error message "AttributeError: 'module' does not contain a 'document' attribute" indicates that the specified module does not have a

I'm trying to use Python (2.7.10) and Selenium to input a username and password, but I keep encountering the following error. Can anyone help me fix it? CODE:- from selenium import webdriver import selenium driver = webdriver.Chrome("/Users/username ...

Verify the presence of a GET parameter in the URL

Working on a simple log in form for my website using Jade and ExpressJS. Everything is functioning correctly, except for one issue - handling incorrect log in details. When users input wrong information, they are redirected back to the log in page with a p ...

Set the directory for npm scripts to a new location

Q: Can the context in which npm runs scripts be altered? What I am trying to accomplish is as follows: "scripts": { "test": "gulp mocha", "pre-install": "./deps/2.7/cpython/configure --prefix=$(pwd)/build --exec-prefix=$(pwd)/build && make ...

Guide to navigating to a different webpage with Node.js

I am a beginner user of NodeJS and I have a specific request. I need assistance with setting up a page redirect from one page to another upon clicking on a link. Any guidance provided will be greatly appreciated. Here is the code snippet: app.js var expr ...

Passport: user information is not saved in the session

Recently, I delved into the world of nodejs and decided to create an authentication system. Following a tutorial, I successfully implemented it. To retrieve the user object after authentication, it is necessary to store it in the session. This was achieved ...

Automating the login process for an application using Python and Selenium for GUI automation

Currently, I am working on a project that requires gathering information from various websites within the company as well as extracting data from a Windows application built in Java. I successfully retrieved all necessary information from the websites usi ...

Encountering issues during the automated creation of a Nuxt.js application using an Express server

I am attempting to launch Nuxt programmatically from my Express server, but I encounter errors once the application is compiled and I check my browser console: https://i.stack.imgur.com/MZxHk.png https://i.stack.imgur.com/sfDIF.png This is how my nuxt.c ...

Encountering challenges with MongoDB's Bulk API as I attempt to transfer my JSON data to MongoDB through NodeJS

Having trouble uploading my json file to MongoDB in a sequential manner using the Bulk API. I keep getting an error message stating "TypeError: bulk.insert is not a function". I've checked the documentation and my syntax seems fine. Any suggestions o ...

Explain the concept of a keyword argument in Python

As a newcomer to django, I am navigating my way through Class Based Views. However, I seem to be encountering the following error frequently: Reverse for 'products.views.'filter_by_led' with arguments '()' and keyword arguments ...

`npm security check reveals a potential vulnerability related to Inefficient Regular Expression Complexity. For more information, refer to: https://github.com/advisories/GHSA-9vvw-cc

# npm audit report debug <3.1.0 debug Inefficient Regular Expression Complexity vulnerability - https://github.com/advisories/GHSA-9vvw-cc9w-f27h No solution currently available node_modules/body-parser/node_modules/debug node_modules/express/node_modu ...

Use Python to access a website button and download a xlsx file with just one click

Currently, I am working on a Python script to generate a daily COVID-19 dashboard for my country and state. Unfortunately, I have hit a roadblock in downloading one of the required files. To download this file, I need to visit the website () and click on ...

Incorporating Stripe functionality into the MeanJs starter template

Hello there! I am relatively new to working with the Mean stack and currently using version 0.4.2 of MeanJS (meanjs.org). My current challenge is integrating Stripe into the platform, and I have decided to use Stripe Angular for this purpose. Progress so ...

Regular expressions for capturing login usernames

I recently worked on a web chat project where I utilized socket.io for real-time message sending and receiving. One of the requirements was to capture user logins if they were mentioned within the conversation. Though being a beginner, I attempted to use ...

Guide to installing and utilizing headless chrome binary within a Jenkins (Linux) environment

Struggling with the lack of a clear plan on how to proceed, here is the situation at hand: I currently have a Protractor test suite running headless using Chrome 60 (beta) binary by specifying the binary location in Chrome options in a Windows environment ...

SailsJS failing to detect changes in local JSON file

https://i.stack.imgur.com/RG13Y.png This sailsjs application does not utilize any database. Instead, it relies on multiple JSON files located in the data folder within the root directory. The controller accesses this data as follows: req.session.categori ...

Tips on developing Middleware for socket communication

Is it possible to attach Middlewares to routes when using sockets with node and express? socket.on('foo', middleware?) ...

Creating an image variable in Python using tkinter

I have successfully set up my homemade music player. Now, I want to enhance it by adding album artwork extracted from the currently playing song using ffmpeg. After extensive research, I am unsure about the most efficient way to integrate this feature with ...

'middle' designation is set as 'None', as per the anticipated value

Having trouble with my import.py, check50 is returning 5 out of 6. Issues occur when the 'middle' name is returned as 'None' instead of without single quotes. I'm unsure how to fix this problem. Below is the code from my import.py ...