When I try to run pipreqs /path/to/project
it comes back with
File "<unknown>", line 1
# !/usr/bin/env python3
^
SyntaxError: invalid non-printable character U+FEFF
my project contains a number of files and all of them contain their own imports. I read somewhere that it could be an issue to create a requirements.txt for a number of files so I tried to move the main file into a new dir and run pipreqs on there but again no success.
my imports look like so:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#######################################################
# Initialise Wikipedia agent
#######################################################
import requests
import json
import aiml
import wikipedia
import numpy as np
from nltk.sem.logic import *
from nltk.inference.resolution import *
from nltk.inference import ResolutionProver
from nltk.inference.nonmonotonic import *
from nltk import *
from nltk.sem import logic
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
import pandas as pd
from fuzzywuzzy import fuzz
import tkinter as tk
from tkinter import filedialog
from azure.cognitiveservices.vision.computervision import ComputerVisionClient
from msrest.authentication import CognitiveServicesCredentials
import tensorflow_hub as hub
Anyone has any ideas on what it could be? Any help would be much appreciated :)
Edit:
Forgot to specify: Running Python 3.9.10
and pipreqs
was installed using pip3
The character U+FEFF is the byte order marker, or BOM.
You can save a text file in UTF encoding with or without BOM, and the error message seems to suggest your system can deal with UTF, but doesn't like the BOM, so you should try rewriting the file without BOM.
Alternatively, there's ways to tell Python to expect a different encoding on the command line with environment variables, but I wouldn't go there unless you absolutely must and have no control over the encoding of the file yourself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With