PortScanner icon indicating copy to clipboard operation
PortScanner copied to clipboard

[BUG] .pyc files needs to be deleted before running this project.

Open Kashish121 opened this issue 3 years ago • 10 comments

An issue occurs when you first try 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.

*.pyc files interfere with normal working of the project.

This issue can be solved by deleting the *.pyc files from the repository folder from the local machine. Refer to this issue thread for details.

Expected behavior - Delete all the *.pyc files automatically before running the project.

Kashish121 avatar Mar 13 '21 15:03 Kashish121

@Kashish121 Currently on working on that too.

palrohitg avatar Mar 13 '21 17:03 palrohitg

@palrohitg assigning it to you. Submit the corresponding PR by tomorrow EOD.

Kashish121 avatar Mar 13 '21 18:03 Kashish121

@Kashish121 I generated the PR #148 and their is no issue while running the flask server for branch features/python3.8 I am using the python3.8 to run the server. For this issue I need to do checkout what the issue is actually while using python2 and then discussion on further. But I think this is not the potential bug for branch features/python3.8 because it clearly mention this branch is for developer who is working with python3. Need to know what do u think?

palrohitg avatar Mar 13 '21 20:03 palrohitg

@Kashish121 I checkout in my local environment once you had python virutalenv activated then there is no issue. It pretty sure, if you are working with python3 env but trying to run the server will be some package which is deprected by python2

image

palrohitg avatar Mar 14 '21 04:03 palrohitg

So, this happens for users who use python2.x and python3.x without a virtual environment setup.

It would still be preferable to remove all the *.pyc files generated during/after execution. @palrohitg you can move forward with writing a piece of code for the same.

Avoiding any possible scope of bug would be a better decision for now.

Kashish121 avatar Mar 14 '21 17:03 Kashish121

@palrohitg , checking for status of work here?

Kashish121 avatar Mar 15 '21 17:03 Kashish121

@Kashish121 What I'm thinking for this issue is that instead of deleting those generated *.pyc files we should prevent their generation in the first place.

jaiongit avatar Mar 15 '21 17:03 jaiongit

@Kashish121 What I'm thinking for this issue is that instead of deleting those generated *.pyc files we should prevent their generation in the first place.

Please expand on this.

Kashish121 avatar Mar 15 '21 18:03 Kashish121

We can set dont_write_bytecode of sys moduletoTrue`. I can create a PR for the same.

jaiongit avatar Mar 15 '21 18:03 jaiongit

We can set dont_write_bytecode of sys moduletoTrue`. I can create a PR for the same.

Sure! go ahead. 👍🏽

Kashish121 avatar Mar 15 '21 18:03 Kashish121