last day (15 days later) » 

18:39
-1
Q: ImportError: No module named base45

SloobotHi so i keep getting the error 'ImportError: No module named base45' for my script and i dont know why here is the script maybe you can figure out what is wrong with it,i have installed the base45 module and cbor2 and qrencode #!/usr/bin/env python import sys import zlib import base45 import cb...

Have you run 'python -m pip install base45', or simply 'pip install base45'?
pip install base45
i tried installing it with 'python -m pip install base45' but it will say requirement already satisfied
ok, yes both of those commands effectively do the same thing, then you do have the package installed already
what could i do to fix this issue?
you have tagged the question with both python2.7 and python-3.x, for which version of python did you install base45?
18:42
Hi
I have the base45 installed for python 2.7
in ubuntu
i tried in kali linux too
but still the same error
when you run python -V what version shows up?
Python 2.7.18
what output do you get for pip -V?
18:47
pip 20.3.4 (python3.9)
seems pip is only installed for python3
need to get pip installed for python2 to run your script
ill try to purge python3 and install pip2 using bootstrap.pypa.io/pip/2.7/get-pip.py
give me 2 sec
i installed pip 20.3.4 (python2.7)
but now when i use the command pip install base45
it would say cannot find a version that satisfies the requierment
requirement
seems base45 package requires Python >=3.6
so you'll need to run your script with python3, not python2 :-/
do i remove the python2.7 and install python3 with sudo apt install python3?
well, remove it only if you don't want python2.7, but you don't have to remove python2.7
18:54
then how can i do it
if you don't need python2.7 for anything, the easiest would be remove python2.7, and only install python3
seems you already have python3 installed too
what does python3 -V output?
do i sudo apt purge python
Python 3.9.7
you can run python3 -m pip install base64 to get that package installed for python3
i'm not much familiar with ubuntu package manager, but just be careful purging python package
i tried that command you sent but it was base45 and it would say its already satisfied but after trying to run the script again it would say the same thing
safest command to remove python2 on ubuntu appears to be sudo apt purge python2.x-minimal
19:00
i tried that and it didnt work and now im trying it on kali linux again
be sure you are running with python3, e.g. python3 yourscript.py
so now im getting this error
Traceback (most recent call last):
File "/home/kali/vacenc/./vacenc", line 11, in <module>
fd = open(sys.argv[1], "rb")
IndexError: list index out of range
you fixed the base45 import problem
i think so from what you said i removed python2.7 and installed python3.9.7 in kali and i didnt get that error anymore but i get that error above
that last IndexError means the script is not getting any input from command line inputs
what commands are you passing when you run your script?
it seems your script is expecting a file to read?
python3 myscript.py afile.txt ?
19:06
the script its like a covid 19 vaccine encoder so its just python3 name.py and then the vaccine code and it should generate a output.png or jpg
like python dictionary script
string
*
okay sounds good
so you are encoding some data from somewhere?
like reading data from a textfile or something?
yes and turning it into a qr code
were you given a file to read from?
it should work like name.py string
when you run your script do you include the string after your script name?
19:10
yes thats how it should work but for some reason it dosent work
python3 name.py mystring?
python3 name.py [somepydictstring]
ok make sure you include all 3 terms when you run it
python3 name.py mystring
i did but i dont know whats up with it
i tried specifying a txt file with the string maybe that made it work but stil nope
the first 2 lines of your code
`fd = open(sys.argv[1], "rb")
data = fd.read()`
means that it is trying to read a file
open() is expecting a file name after the name.py from your command
19:14
oh im dumb af
i fotgot to put the sting like 'string'
because it had $
thanks for helping me
now it works
glad you figured it out!
thanks so much
have a really nice day!
great, i'm stiff confused, but glad you got it 😀
thanks you too, good luck!

last day (15 days later) »