I am using the following code:
import pandas as pd, pyodbc
from sqlalchemy import create_engine
import urllib
def connStrMDBV2(fname):
driver = r'DRIVER={Microsoft Access Driver (*.mdb, *.accdb)}'
connection_string = (fr"{driver};DBQ={fname};ExtendedAnsiSQL=1;")
connection_uri = f"access+pyodbc:///?odbc_connect={urllib.parse.quote_plus(connection_string)}"
engine = create_engine(connection_uri)
return engine
fname = fr'C:\Users\asd\Desktop\test11\mytest.mdb'
connStrMDBV2(fname)
I get the error:
raise exc.NoSuchModuleError(
sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:access.pyodbc
I have checked all the packages are already installed and I am not using virtual environment. It used to work on Python 3.8 and I am getting error after upgrading to Python 3.11
I got this error messege when I do selenium.
Message: session not created: This version of ChromeDriver only supports Chrome version 94
Current browser version is 98.0.4758.102 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe
So I tried to install Chrome version 94. However, even in the ver 94, there are three kinds of ver94. Which ver94 should I install?
ChromeDriver 94.0.4606.113
ChromeDriver 94.0.4606.61
ChromeDriver 94.0.4606.41
here chrome construct path parameter represent chrome driver path
webdriver.Chrome("E:\idm\compressed\chromedriver.exe")
Install selenium package
pip install selenium
Selenium code
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome("E:\idm\compressed\chromedriver.exe")
driver.get("http://www.python.org")
assert "Python" in driver.title
elem = driver.find_element_by_name("q")
elem.clear()
elem.send_keys("pycon")
elem.send_keys(Keys.RETURN)
assert "No results found." not in driver.page_source
# driver.close()
I am trying to use ImageDataBunch from fastai, and it worked fine, but recently when I ran my code, it showed this error ModuleNotFoundError: No module named 'fastai.vision'
Then, I upgraded my fastai version pip install fastai --upgrade. This error got cleared but landed in NameError: name 'ImageDataBunch' is not defined
Here's my code:
import warnings
import numpy as np
from fastai.vision import *
warnings.filterwarnings("ignore", category=UserWarning, module="torch.nn.functional")
np.random.seed(42)
data = ImageDataBunch.from_folder(path, train='.', valid_pct=0.2,
ds_tfms=get_transforms(), size=224, num_workers=4, no_check=True).normalize(imagenet_stats)
How can I fix this?
I actually ran into this same issue when I started using Colab, but haven't been able to reproduce it. Here was the thread describing what I and another developer did to troubleshoot: https://forums.fast.ai/t/no-module-named-fastai-data-in-google-colab/78164/4
I would recommend trying to factory reset your runtime ( "Runtime" -> "Factory Reset Runtime")
Then you can check which version of fastai you have (you have to restart the runtime to use the new version if you've already imported it)
import fastai
fastai.__version__
I'm able to run fastai.vision import * on fastai version 1.0.61 and 2.0.13
In Google Colab:
Upgrade fastai on colab:
! [ -e /content ] && pip install -Uqq fastai
Import necessary libraries:
from fastai.vision.all import *
from fastai.text.all import *
from fastai.collab import *
from fastai.tabular.all import *
Get the images and annotations:
path = untar_data(URLs.PETS)
path_anno = path/'annotations'
path_img = path/'images'
print( path_img.ls() ) # print all images
fnames = get_image_files(path_img) # -->> 7390 images
print(fnames[:5]) # print first 5 images
The solution that worked for me is to copy to (connect) my google drive & then run the cells. Source
You might have installed the older version of fastai. You need to upgrade to fastaiv2. You can upgrade fastai by using pip as shown below.
!pip install fastai --upgrade
Also check your fastai version using
import fastai
print(fastai.__version__)
I have used pyttsx on my desktop but new to using it on an android mobile phone.
I recently downloaded Pyttsx
pip install pyttsx
I ran a little tester on the QPython console but came across an error I haven't seen before.
>>>import pyttsx
>>>engine = pyttsx.init()
the last line of error states:
ImportError: cannot import name c_wchar_p
So I tried to import ctypes
>>>>import ctypes
>>>>import pyttsx
>>>>engine = pyttsx.init()
But had the same error occur. Any ideas?
Thanks
I am new to using web driver but I have followed what was mentioned here (How can I launch Chrome with an unpacked extension?) and all that I could get from other web search.
I am trying to test an extension for chrome which I have developed but I haven't been able to figure out how to start chrome with extension loaded on it. Here is what I have till now and I would appreciate if someone could tell me the issue with the code (I was successful in launching Chrome using webdriver):
import time
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
browser = webdriver.Chrome() browser.get('http://seleniumhq.org/')
ChromeOptions options = new ChromeOptions();
options.addArguments("load-extension=C:\Users\mave\Desktop\Browser_Extension_Feature\extension_v5");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
ChromeDriver driver = new ChromeDriver(capabilities);
time.sleep(15)
browser.quit()
I was finally able to figure out how to run an unpacked extension and would leave this code for anyone who has similar troubles in future:
import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("load-extension=C:\Users\mave\Desktop\Browser_Extension_Feature\extension_v5");
browser = webdriver.Chrome(chrome_options=chrome_options)
browser.get('http://www.seleniumhq.org/')
time.sleep(5)
browser.quit()