LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-04-2022, 01:17 AM   #31
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,976

Rep: Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337

Quote:
Originally Posted by dedec0 View Post
The main problem it has is the formatting chosen for the source lines that insert the data in the database. It has the issue isolated and shown in this separate thread: Python syntax problem?. Specifically, the main problem is in the lines:

Code:
...
133         bdBicicletas.executemany
134         (
135             "INSERT INTO produtos VALUES ( ?, ?, ?, ?, ?, ?, ?)",
136             dadosDeTeste
137         )
...
Because there is no "" in the end of the line 133, this line is valid, but does nothing. The lines 134-137 are also valid, and they are separated from 133, but also do nothing.
This is where pylint can definitely help. It won't be able to tell you what is the correct solution, but will be able to tell you the code does nothing. If you wish you can check it again.
 
1 members found this post helpful.
Old 07-04-2022, 08:24 AM   #32
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Original Poster
Rep: Reputation: 51
Thumbs down

Quote:
Originally Posted by pan64 View Post
This is where pylint can definitely help. It won't be able to tell you what is the correct solution, but will be able to tell you the code does nothing. If you wish you can check it again.
It told me the code did not do anything, but without any explanation. So, I considered this statement wrong, and proceeded to other things pylint told.
 
Old 07-04-2022, 11:25 AM   #33
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,976

Rep: Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337
Quote:
Originally Posted by dedec0 View Post
It told me the code did not do anything, but without any explanation. So, I considered this statement wrong, and proceeded to other things pylint told.
And you learned that was true. And there is a page on the net where all the pylint messages are explained, just you need to look for it.
https://pycodequ.al/docs/pylint-mess...ighlight=w0231
 
1 members found this post helpful.
Old 07-04-2022, 11:55 AM   #34
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206
Quote:
Originally Posted by dedec0 View Post
It told me the code did not do anything, but without any explanation. So, I considered this statement wrong, and proceeded to other things pylint told.
The fact that the code does nothing is the explanation. Your conclusion that the message was wrong was... wrong.

Debugging tools do their best to identify problems and bring them to our attention. Usually problems are identified when a parser, or tool, cannot proceed or has a set of symbols it cannot resolve within its current context. The point where that happens can be far from the actual error which causes it, and there may be many possible errors which could produce the same problem, so it is not always possible for the tool to identify the specific cause in any given case.

In this case, it told you that the block of code had no effect - it doesn't do anything - and you are expected to know what you intended for it to do and how it should do so, and to figure out why it does not, in fact, work. It was not possible for it to tell you exactly why it did nothing. If that were the case it could simply fix it for you and continue!

Learn to trust the messages produced by your tools and to understand why any given message was produced. In the occasional case where a message may be superfluous, you should still be able to identify why it was produced!
 
1 members found this post helpful.
Old 07-04-2022, 12:01 PM   #35
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by pan64 View Post
And you learned that was true. And there is a page on the net where all the pylint messages are explained, just you need to look for it.
https://pycodequ.al/docs/pylint-mess...ighlight=w0231
To find what solves errors/warnings is easy. Detailed explanation, I am not sure. Does the link you point explain things like what people did in this thread? (I did not check for the case we are discussing because I am want to know more about possible future uses of that link, compared to other search results I can find)
 
Old 07-04-2022, 12:05 PM   #36
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Original Poster
Rep: Reputation: 51
Smile

Quote:
Originally Posted by astrogeek View Post
The fact that the code does nothing is the explanation. Your conclusion that the message was wrong was... wrong.

Debugging tools do their best to identify problems and bring them to our attention. Usually problems are identified when a parser, or tool, cannot proceed or has a set of symbols it cannot resolve within its current context. The point where that happens can be far from the actual error which causes it, and there may be many possible errors which could produce the same problem, so it is not always possible for the tool to identify the specific cause in any given case.

In this case, it told you that the block of code had no effect - it doesn't do anything - and you are expected to know what you intended for it to do and how it should do so, and to figure out why it does not, in fact, work. It was not possible for it to tell you exactly why it did nothing. If that were the case it could simply fix it for you and continue!

Learn to trust the messages produced by your tools and to understand why any given message was produced. In the occasional case where a message may be superfluous, you should still be able to identify why it was produced!
Yes. I am learning to use this new tool, pylint, as I am learning the basics of Python. Thank you for these comments, astrogeek.
 
Old 07-04-2022, 12:14 PM   #37
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,976

Rep: Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337
Quote:
Originally Posted by dedec0 View Post
To find what solves errors/warnings is easy. Detailed explanation, I am not sure. Does the link you point explain things like what people did in this thread? (I did not check for the case we are discussing because I am want to know more about possible future uses of that link, compared to other search results I can find)
Ok, that is a general page, not for you, not for me, just a general description about what was found. You not only need to understand why it was reported, but you have to know if that was intentional or actually something went wrong.
In this case I can suggest you to post the exact message you got and I will try to explain how should it be handled. (again, in general you need to enter the code - or type - of that message, which is something like W0345 and it will give a special explanation for that, what the authors think about that case).
 
1 members found this post helpful.
Old 07-04-2022, 12:25 PM   #38
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by pan64 View Post
Ok, that is a general page, not for you, not for me, just a general description about what was found. You not only need to understand why it was reported, but you have to know if that was intentional or actually something went wrong.
In this case I can suggest you to post the exact message you got and I will try to explain how should it be handled. (again, in general you need to enter the code - or type - of that message, which is something like W0345 and it will give a special explanation for that, what the authors think about that case).
If I knew pylint before starting this thread, I would have understood the other things it pointed in my code. My question would contain only the lines I copied in the post #30, which is the post where I joined everything that solved this thread. So, if more Python help is needed, and information around the web does not help enough, I should write a better question, possibly much smaller and direct.

See you around!

Last edited by dedec0; 07-04-2022 at 12:26 PM.
 
  


Reply

Tags
flask, python, sqlite



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How to Install SQLite and SQLite Browser on Ubuntu 20.04 LXer Syndicated Linux News 0 04-25-2021 07:36 AM
How to save live data into sqlite database using c language? Newbie89 Linux - Newbie 1 04-29-2013 12:59 AM
LXer: Sqlite-Commander - A ncurses based tool to display the records and tables of a sqlite database LXer Syndicated Linux News 0 01-02-2011 08:11 AM
python / sqlite - database locked despite large timeouts acid_kewpie Programming 3 04-08-2010 05:44 AM
[python] sqlite: Can you combine two database files? BrianK Programming 6 09-11-2008 06:59 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration