vinitshahdeo / PortScanner

A go-to tool for scanning network. Scan all the open ports for a given host with just one click.
https://vinitshahdeo.github.io/PortScanner/
MIT License
125 stars 114 forks source link

Error on running the Flask UI with Python 3 #127

Open jaiongit opened 3 years ago

jaiongit commented 3 years ago

While working with Python 3 (version 3.9.1 on my local machine) and checking out to feature/python3.8 branch the following error occurs when trying to run the Flask UI:

File "/path/to/PortScanner/src/mainScanner.py", line 10, in <module>
    from multi.scanner_thread import split_processing
ImportError: bad magic number in 'multi': b'\x03\xf3\r\n'

I am assuming this is caused due to using more recent Python 3 version than the one specified in README.md.

Mentioning @Kashish121 as stated by @vinitshahdeo.

Originally this issue was discussed here.

welcome[bot] commented 3 years ago

Thanks for opening your first issue! Mentors will get back to you soon. Meanwhile check this repo for more.

Hacktoberfest2020

jaiongit commented 3 years ago

I've discovered that this issue occurs when someone first tries to run the CLI through Python2. This results in creation of Python2 *.pyc files on the local machine. After this if the those files are not deleted and on running Flask UI through Python3 (which uses old Python2 *.pyc file), we get the above error. This issue will be fixed if those files are deleted before running the Flask UI through Python3.

Kashish121 commented 3 years ago

@jaiongit I came across this explanation while looking for error you mentioned. Thanks for putting it up here. 💯

Solution: Just delete all .pyc files located in the same directory as .py files.

Hope the issue is resolved.

jaiongit commented 3 years ago

@Kashish121 So, should this issue be closed? Or we need to delete .pyc files automatically (if possible). I think if that's not possible we should mention this in the README.

Kashish121 commented 3 years ago

Raised an issue #150 , keeping this issue open for future references.