python3 show an unexpected require "Input the LENGTH of token" - python-3.x

I'm a newbie on python3. When I import some libs of python3 then I run my code, I always get the same unexpect result that required
"Input the LENGTH of token"
then if I enter a number for first require, the next question is
"Input the filename:"
some libs I imported and got that issues: scapy.all, ftplib, dns.resolver
enter image description here
I dont event code any require like that in my code. What is my problem with the code? what's thing I dont understand with that libs?
Thanks all mates
try leaning with python

Related

Convert ANSYS MECHANICAL files to VTK using APDL

I have followed the script provided here by DaveD here:
How to read Ansys data files in ParaView?
But I am unable to get a result that Paraview can import. I attach a few screenshots, because several warnings came out while the script was being run. I got a vtk as output (360 MB, so I guess it contains something...), but Paraview displays the following error:
ERROR: In C:\glr\builds\paraview\paraview-ci\source-paraview\VTK\IO\Legacy\vtkUnstructuredGridReader.cxx, line 320
vtkUnstructuredGridReader (000001CECD70BC00): Unrecognized keyword: 0.00000e+00
I have never used APDL, so I will be happy if the author of the script or someone experienced using it could tell me what I did wrong (I continued clicking "yes" through all the windows and I got the output.vtk as I mentioned)
Thanks a lot in advance
enter image description here

Export SQLite3 to CSV with Python. sqlite3.OperationalError: near ".": syntax error

I need some help with my code, because I cannot understand why is giving to me this error (sqlite3.OperationalError: near ".": syntax error).
I want to export a database.db to database.csv from Python, and this code works fine on sqlite3, but when I typed on Python3 with cur.execute() this error appears.
Now this is my code where the bug is
fname = input('Name for the csv?\n> ')
cur.execute('.headers on')
cur.execute('.mode csv')
cur.execute(f'.output {fname}.csv')
I searched on other forums but I think that this is a particular case.
I hope somebody can help me fixing the error, or giving me an alternative way to export the database to csv with python.
You can't do that. These commands work only within the sqlite executable and can't be used like regular SQL commands or pragrmas. What you could do in Python is run a shell command.

how to fix "Module 'cv2' has no ---- member pylint(no-member?

I am trying to start a project to learn how to use opencv and the first problem I encountered is this : "Module 'cv2' has no ---- member pylint(no-member) as posted in the picture.
I have found some information here in Stack Overflow but I'm afraid, I might not be proficient enough to understand what is going on. Could someone point me in the right direction to solve my problem?
Thanks!
One possible reason is that you might have a file named cv2.py somewhere on your machine other than the original cv2 module and now python is importing that file rather than the cv2 module.
Or perhaps you could've downloaded a wrong cv2 module, other than that i don't see anything that could've gone wrong as you don't have a complex code. Try reinstalling the module and/or removing a file named cv2.py (if you've accidentaly created one).
You can check the module by importing the module in the terminal and check for dir, on python console type import cv2 and then dir(cv2), now you should see all the classes contained in the cv2 module.
If the program runs correctly then I guess you are facing linting issue which is answer in this [https://stackoverflow.com/questions/26657265/hide-some-maybe-no-member-pylint-errors] question.
Solution is to turn off no-member linting error using below command
pylint disable=maybe-no-member
OR
pylint --disable=E1101

Importing a method from user-defined module gives Attribute Error

I am going through python crash course book and i want to import a module that i have written its function and saved it properly in the path.
using pycharm, python 3.7
I have properly written the code and i know it exists(the attribute) in the imported module.
the code is this:
def make_pizza(size, *toppings):
"""Summarize the pizza we are about to make."""
print(f"\nMaking a {size}-inch pizza with the following toppings:")
for topping in toppings:
print(f"- {topping}")
but i get this error AttributeError: module 'pizza' has no attribute 'make_pizza'
I dont know what to do,i really need to solve this problem to be able to continue my learning.
You should save your module and then check for the directory structure, if it is like,
|-pizza/
|--pizza.py
Then try this for importing pizza module in another python program:
from pizza import pizza
pizza.make_pizza(10,...)
I hope this helps. This maybe because of your package structure.

Python 3.6.4 - urllib.request.urlopen certificate verify failed error

Trying to teach myself how to use urllib.request in Python 3.6.4 - however, I can't seem to get a basic example to work. Below is the code that I am running, copied straight from Python's documentation at this link.
>>> import urllib.request
>>> with urllib.request.urlopen('http://www.python.org/') as f:
... print(f.read(300))
A picture of the error I get is here. It tells me that the SSL certificate verify failed (I'm unsure of what this means).
I don't think there is anything wrong with the code I am running, but maybe I'm missing a step to setting up the environment. From what I can tell, it should be as simple as running those few lines of code. Any help is greatly appreciated.
As a quick background, I've taken 2 computer science courses at university, so I am by no means an expert, but I do have a pretty solid understanding of basic programming with Python. I'm trying to use this to scrape data in conjunction with BeautifulSoup.

Resources