import csv import sqlite3 import os if os.path.isfile('phones.db'): os.remove ('phones.db') conn= sqlite3.connect('phones.db') db=conn.cursor() db.execute("PRAGMA foreign_keys = ON") db.execute ("""CREATE TABLE phones (phoneID INTEGER PRIMARY KEY, phone_colour TEXT, phone_model INTEGER, storage_size INTEGER, price TEXT)""") reader = csv.reader(open('phones.txt', 'r'), delimiter=',') for row in reader: to_db = [row[0], row[1], row[2], row[3], row[4] ] db.execute('''INSERT INTO phones (phoneID,phone_colour, phone_model,storage_size, price) VALUES (?,?,?,?,?);''', to_db) db.execute ("""CREATE TABLE customer (clientID INTEGER PRIMARY KEY, firstname TEXT, surname TEXT, age INTEGER, number INTEGER, email STRING)""") reader = csv.reader(open('clients.txt', 'r'), delimiter=',') for row in reader: to_db = [row[0], row[1], row[2], row[3], row[4], row[5] ] db.execute('''INSERT INTO customer (clientID, firstname, surname, age, number,email) VALUES (?,?,?,?,?,?);''', to_db) db.execute ("""CREATE TABLE purchase (purchaseID INTEGER PRIMARY KEY, clientID INTEGER, datepurchased TEXT, timepurchased INTEGER, phoneID INTEGER, purchasedetails TEXT, price INTEGER, FOREIGN KEY(clientID)REFERENCES customer(clientID), FOREIGN KEY(phoneID)REFERENCES phones(phoneID))""") reader = csv.reader(open('clients.txt', 'r'), delimiter=',') for row in reader: to_db = [row[0], row[1], row[2], row[3], row[4], row[5], row[6] ] db.execute('''INSERT INTO purchase (purchaseID,clientID,datepurchased,timepurchased,phoneID,purchasedetails,price) VALUES (?,?,?,?,?,?,?);''', to_db) conn.commit conn.close
What I have tried:
I’m trying to get my three tables to work but they aren’t. This is the error I keep getting. Please help me.
IntegrityError: datatype mismatch phones.py, line 37 No specific suggestions for this error (yet). Let Thonny developers know Click on the feedback link at the bottom of this panel to let Thonny developers know about your problem. They may add support for such cases in future Thonny versions. Search the web
This is the csv file for table customer
0300,Charles,Clerk,21,0401273640,Charlieb@hotmail.com, 0301,Hunter,Parker,23,0490876598,Hunterparker@gmail.com, 0302,Zack,Davis,34,0412567456,Zdavis@hotmail.com, 0303,Gina,Porter,21,0489768990,PorterGina@outlook.com, 0304,Jane,Grey,42,0445673897,Janegrey@yahoo.com, 0305,Elijah,Casswell,34,0456487650,EJcasswell@gmail.com, 0306,Joshua,Bass,24,0498734523,Joshuabass@gmail.com, 0307,Rose,Colton,54,0410987603,RoseColton@gmail.com, 0308,Hazel,Stan,43,040913567543,Stanhazel@hotmail.com, 0309,Valentina,Brown,28,0445637864,ValBrown@yahoo.com,
I am attempting to install the software for the RPLidar unit. I am using V1 Buster on a Raspberry Pi 4B 8GB and enter the command
Code: Select all
pip install Adafruit_CircuitPython_RPLIDAR
as per the adafruit instructions but unfortunately it does not work. What do I need to do to get it working?
The following message shows up: Command «python setup.py egg_info» failed with error code 1 in /tmp/pip-install-58nrga/Adafruit-CircuitPython-RPLIDAR/
Here is the entire output:
Using cached https://files.pythonhosted.org/packages … 2.7.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File «<string>», line 1, in <module>
File «/tmp/pip-install-58nrga/Adafruit-CircuitPython-RPLIDAR/setup.py», line 54, in <module>
py_modules=[«adafruit_rplidar»],
File «/usr/lib/python2.7/dist-packages/setuptools/__init__.py», line 144, in setup
_install_setup_requires(attrs)
File «/usr/lib/python2.7/dist-packages/setuptools/__init__.py», line 139, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File «/usr/lib/python2.7/dist-packages/setuptools/dist.py», line 724, in fetch_build_eggs
replace_conflicting=True,
File «/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py», line 782, in resolve
replace_conflicting=replace_conflicting
File «/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py», line 1065, in best_match
return self.obtain(req, installer)
File «/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py», line 1077, in obtain
return installer(requirement)
File «/usr/lib/python2.7/dist-packages/setuptools/dist.py», line 791, in fetch_build_egg
return cmd.easy_install(req)
File «/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py», line 704, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File «/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py», line 730, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File «/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py», line 915, in install_eggs
return self.build_and_install(setup_script, setup_base)
File «/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py», line 1183, in build_and_install
self.run_setup(setup_script, setup_base, args)
File «/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py», line 1169, in run_setup
run_setup(setup_script, args)
File «/usr/lib/python2.7/dist-packages/setuptools/sandbox.py», line 253, in run_setup
raise
File «/usr/lib/python2.7/contextlib.py», line 35, in __exit__
self.gen.throw(type, value, traceback)
File «/usr/lib/python2.7/dist-packages/setuptools/sandbox.py», line 195, in setup_context
yield
File «/usr/lib/python2.7/contextlib.py», line 35, in __exit__
self.gen.throw(type, value, traceback)
File «/usr/lib/python2.7/dist-packages/setuptools/sandbox.py», line 166, in save_modules
saved_exc.resume()
File «/usr/lib/python2.7/dist-packages/setuptools/sandbox.py», line 141, in resume
six.reraise(type, exc, self._tb)
File «/usr/lib/python2.7/dist-packages/setuptools/sandbox.py», line 154, in save_modules
yield saved
File «/usr/lib/python2.7/dist-packages/setuptools/sandbox.py», line 195, in setup_context
yield
File «/usr/lib/python2.7/dist-packages/setuptools/sandbox.py», line 250, in run_setup
_execfile(setup_script, ns)
File «/usr/lib/python2.7/dist-packages/setuptools/sandbox.py», line 44, in _execfile
code = compile(script, filename, ‘exec’)
File «/tmp/easy_install-n8O_QX/setuptools_scm-7.0.5/setup.py», line 20
def scm_version() -> str:
^
SyntaxError: invalid syntax
—————————————-
Command «python setup.py egg_info» failed with error code 1 in /tmp/pip-install-58nrga/Adafruit-CircuitPython-RPLIDAR/
Всем доброго времени суток.
Получаю такую ошибку
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Tue Jul 13 11:50:39 GMT+04:00 2021
There was an unexpected error (type=Not Found, status=404).
No message available
Controller
package org.purposetracking.controller;
import org.purposetracking.model.User;
import org.purposetracking.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class UserController {
@Autowired
private UserService userService;
@GetMapping(«/users»)
public String showUsers(Model model) {
Iterable users = userService.getAll();
model.addAttribute(«users», users);
return «index»;
}
}
application.properties
# ===============================
# = DATA SOURCE
# ===============================
# Set here configurations for the database connection
spring.datasource.url=jdbc:postgresql://localhost:5432/purposes-tracking
spring.datasource.username=postgres
spring.datasource.password=12332112
spring.datasource.driver-class-name=org.postgresql.Driver
# Keep the connection alive if idle for a long time (needed in production)
spring.datasource.testWhileIdle=true
spring.datasource.validationQuery=SELECT 1
# ===============================
# = JPA / HIBERNATE
# ===============================
# Show or not log for each sql query
spring.jpa.show-sql=true
# Hibernate ddl auto (create, create-drop, update): with «create-drop» the database
# schema will be automatically created afresh for every start of application
#spring.jpa.hibernate.ddl-auto=create-drop
# Naming strategy
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl
spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
# Allows Hibernate to generate SQL optimized for a particular DBMS
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
Подскажите, пожалуйста, куда копать?
-
Вопрос заданболее года назад
-
1401 просмотр
На основании Вашего запроса эти примеры могут содержать грубую лексику.
На основании Вашего запроса эти примеры могут содержать разговорную лексику.
You might also ask the journal editors if they have any suggestions for this.
Вы можете также задать свои вопросы в редакцию журнала, если у них есть какие-либо предложения для этого.
There are different principles and suggestions for this.
Anybody have some suggestions for this?
Send us your suggestions for this timeline.
States have not yet provided comments or suggestions for this paper that relate to this critical issue.
Государства еще не предоставили комментарии или предложения к данному документу в контексте этого важнейшего вопроса.
We have some great suggestions for this winter.
I have two suggestions for this game.
I need some suggestions for this year.
The following suggestions for this list of categories may be considered:
Please send your suggestions for this website to:
After own suggestions for this complex a suggestion for the content coordination with the small entrepreneurs is to be worked out after a feedback of the university there.
После собственных предложений по этому комплексу предложение по согласованию содержания с малыми предпринимателями должно быть разработано после отзывов от университета.
Several suggestions for this mandate were put forward, such as development of guidance documents, starters kits and leaflets, and facilitation of exchange of information.
В отношении мандата было выдвинуто несколько предложений, в частности подготовка руководящих документов, комплектов вспомогательных пособий и брошюр, а также содействие информационному обмену.
Questions, comments, suggestions for this site
Here are some suggestions for this initial step
Do you have any ideas or suggestions for this blog?
Here are some serving suggestions for this delicious cocktail
You can not leave suggestions for this project, as it is only available for users with PRO-account.
Вы не можете оставлять предложения по данному проекту, так как он доступен только для пользователей с PRO-аккаунтом.
Thanks to everyone on Twitter who made suggestions for this post!
We had some suggestions for this young, ambitious team which proved to be constructive, as they created excellent products with the help of their knowledge and experience acquired in extensive practice.
Предложения, которые мы дали этой молодой, амбициозной команде оказались хорошие, потому что они с помощью своих знаний и наблюдений, приобретенных при усиленной практике, создали отличные продукты.
Have any questions, feedback or suggestions for this website, or just wish to say hello?
У Вас есть идеи, пожелания, замечания по сайту, или Вы желаете просто высказаться…
Результатов: 26. Точных совпадений: 26. Затраченное время: 98 мс
Documents
Корпоративные решения
Спряжение
Синонимы
Корректор
Справка и о нас
Индекс слова: 1-300, 301-600, 601-900
Индекс выражения: 1-400, 401-800, 801-1200
Индекс фразы: 1-400, 401-800, 801-1200
関係者殿
yama286です
『最新RaspberryPiで学ぶ電子工作』金丸隆志著(講談社)
1.いきさつ
年明けより上記本で勉強している初心者です。
1~7章は実機でうまくいきました。8章のLEDのPWM制御もうまくいきました。
8.5のPWM信号によるDCモータの速度制御もうまくいきました。
ところが8.6のサーボモータの角度制御 08-04-servo.py を実行すると
で下記エラーが出てうまくいきません。
ImportError:No module named ‘wiringpi’
2.内容
画像の貼り付け方がまだわかりませんので詳細を書きします。以下はTH Thonnyの画面の一部です。
——————————————————————
1)プログラム
行番は左の数字です
1 # —— coding: utf-8 ——
2 import RPi.GPIO as GPIO
3 from time import sleep
4 import wiringpi
5
6
7 # MCP3208からSPI通信で12ビットのデジタル値を取得。0から7の8チャンネル使用可
8 def readadc(adcnum, clockpin, mosipin, misopin, cspin):
9 if adcnum > 7 or adcnum < 0:
10 return -1
11 GPIO.output(cspin, GPIO.HIGH)
12 GPIO.output(clockpin, GPIO.LOW)
13 GPIO.output(cspin, GPIO.LOW)
14
15 commandout = adcnum
16 commandout |= 0x18 # スタートビット+シングルエンドビット
17 commandout <<= 3 # LSBから8ビット目を送信するようにする
中間省略
81 GPIO.cleanup()
2)Shell メッセージ
%Run 08-04-servo.py
Traceback (most recent call last):
File «/home/pi/bluebacks/08-04-servo.py», line 4, in <module>
import wiringpi
File «/usr/lib/python3/dist-packages/thonny/backend.py», line 317, in _custom_import
module = self._original_import(*args, **kw)
ImportError: No module named ‘wiringpi’
3)Assistant メッセージ
ImportError: No module named ‘wiringpi’
backend.py, line 317
No specific suggestions for this error (yet).
Let Thonny developers know
Search the web
上記2)Shell メッセージ及び3)Assistant メッセージに示すように
No module named ‘wiringpi’
というエラーメッセージが出てしまいます。
3.疑問点1
冒頭にも書きましたが、8章のLEDのPWM制御もうまくいきました。ここでは
RPi.GPIOを利用しています。今回の8.6のサーボモータの角度制御から
wiringPiを使用しています。プログラムを動かす前にターミナルで9行のコマンド を入れました。
しかしswig2.0コマンドが見つかりません
というものが出てうまくいきません。市販の本の通りにやってもなぜうまくいかな いのかわかりません。
ただ初心者ですので、何かミスをしているのかもしれません。
4.試したこと
1)webでいろいろ調べてやっているうちに、3.で示した”swig2.0コマンドが見つか
りません”は出なくなりました。
2)wiringpi_wrap.cというファイルに原因があります。という記事があり下記のよ うにviエディタで修正しました。下記行を追加しました。
#define PyString_FromStringAndSize(x,len)PyUnicode_FromStringAndSize(x,len)
3)その後 import wiringpi2 を実行することになっていたので、実行するとエ ラーは出ませんでした。
4)wiringPiのコマンドラインテストを実施
gpio -g mode 18 out
gpio -g write 18 1 LED 点灯
gpio -g write 18 0 LED 消灯
以上のようにgpioコマンドは正常の動作していると思われます。
5.疑問点2
その後、問題の08-04-servo.py を実行するとNo module named ‘wiringpi’が出 てしまいます。
上記4-4)のgpioの出力制御はうまくいっているのに、なんで上記エラーが出るの でしょうか?
6.依頼事項
まだどこか抜けているところがあると思います。
以上よろしくご教授お願いいたします。
0
ベストアンサー
yama286さん、
ImportErrorですが、wiringpiのpythonモジュールが導入されますか?
sudo pip3 install wiringpi
をしてみてください。
- RaspberryPi 3B + 2018-11-13-raspbian-stretch-full にて確認。Thonny上でも、ImportErrorはでなくなりました。
pi@raspberrypi:~ $ python3 Python 3.5.3 (default, Sep 27 2018, 17:25:39) [GCC 6.3.0 20170516] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import wiringpi Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named 'wiringpi' >>> exit() pi@raspberrypi:~ $ pi@raspberrypi:~ $ sudo pip3 install wiringpi Collecting wiringpi Downloading https://files.pythonhosted.org/packages/ce/1f/74901a3c842daeb22447c07c48826d2c6aeb0d988370792e2aa2221f7a36/wiringpi-2.46.0-cp35-cp35m-linux_armv7l.whl (262kB) 100% |████████████████████████████████| 266kB 665kB/s Installing collected packages: wiringpi Successfully installed wiringpi-2.46.0 pi@raspberrypi:~ $ pi@raspberrypi:~ $ python3 Python 3.5.3 (default, Sep 27 2018, 17:25:39) [GCC 6.3.0 20170516] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import wiringpi >>> exit() pi@raspberrypi:~ $
15分調べてもわからないことは
teratailで質問しよう!
ただいまの回答率
86.02%
質問をまとめることで
思考を整理して素早く解決
テンプレート機能で
簡単に質問をまとめる
質問する