Hello!
So i have been working with python on Ubuntu which i boot from a pendrive on a computer whose hard disk is corrupted. I had taken the pen-drive off the computer while it was in sleep mode, used the pendrive on another computer and then plugged it back in to the sleeping computer. Just for fun, i thought i'll run it like that. BIG MISTAKE!
Now, even writing
All my files are preserved. No problems there, but no code is running.
Please advise what i can do to fix this problem
This is extremely weird.
EDIT:
I'm able to import os, time, shutil, pprint, bs4, openpyxl normally.
Okay, so i followed the path in the traceback and found the corrupted file. Then replaced it with the file with the same name on GitHub. Now its working :)
So i have been working with python on Ubuntu which i boot from a pendrive on a computer whose hard disk is corrupted. I had taken the pen-drive off the computer while it was in sleep mode, used the pendrive on another computer and then plugged it back in to the sleeping computer. Just for fun, i thought i'll run it like that. BIG MISTAKE!
Now, even writing
import requestsgives me an error like this:
Error:>>> import requests
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/bunni/.local/lib/python3.6/site-packages/requests/__init__.py", line 43, in <module>
import urllib3
File "/home/bunni/.local/lib/python3.6/site-packages/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/home/bunni/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 36, in <module>
from .response import HTTPResponse
ValueError: source code string cannot contain null bytes
I tried uninstalling and reinstalling it using pip3, but it wont work either, and shows a similar error. This is not just with requests. even selenium doesnt work now.All my files are preserved. No problems there, but no code is running.
Please advise what i can do to fix this problem
This is extremely weird.
import seleniumitself doesnt return any error, but
from selenium import webdriverreturns the following error:
Error:from selenium import webdriver
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/bunni/.local/lib/python3.6/site-packages/selenium/webdriver/__init__.py", line 18, in <module>
from .firefox.webdriver import WebDriver as Firefox # noqa
File "/home/bunni/.local/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 29, in <module>
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
File "/home/bunni/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 27, in <module>
from .remote_connection import RemoteConnection
File "/home/bunni/.local/lib/python3.6/site-packages/selenium/webdriver/remote/remote_connection.py", line 24, in <module>
import urllib3
File "/home/bunni/.local/lib/python3.6/site-packages/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/home/bunni/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 36, in <module>
from .response import HTTPResponse
ValueError: source code string cannot contain null bytes
>>> import pprint
>>> import selenium
>>> from selenium import webdriver
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/bunni/.local/lib/python3.6/site-packages/selenium/webdriver/__init__.py", line 18, in <module>
from .firefox.webdriver import WebDriver as Firefox # noqa
File "/home/bunni/.local/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 29, in <module>
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
File "/home/bunni/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 27, in <module>
from .remote_connection import RemoteConnection
File "/home/bunni/.local/lib/python3.6/site-packages/selenium/webdriver/remote/remote_connection.py", line 24, in <module>
import urllib3
File "/home/bunni/.local/lib/python3.6/site-packages/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/home/bunni/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 36, in <module>
from .response import HTTPResponse
ValueError: source code string cannot contain null bytes
It looks like only one file is not working properly...Any inputs on how to locate and fix it?EDIT:
I'm able to import os, time, shutil, pprint, bs4, openpyxl normally.
Okay, so i followed the path in the traceback and found the corrupted file. Then replaced it with the file with the same name on GitHub. Now its working :)