I have flask code in helloflask.py and abcd.py in the same folder:  import abcd as abc     @app.route("/ddata")     def stuff1():          p=abc.run('somefile.txt')         return json.dumps(p)   abcd.py has following code  connection = sqlite3.connect('C:\\Users\me\Desktop\Python\my.db') cursor=connection.cursor()  def dbcall(ip_rel,c_mac):     sql="select count(*) from myDB"     cursor.execute(sql)     row=cursor.fetchone()     count =row[0]      return count #I am returning a list here in my original code   When I run helloflask.py I get following error while retrieving rows:  ERROR:     File "C:\Users\mvahuje\Desktop\Python\Application\Dsharkclass.py",   line 25, in dbcall    cursor.execute(sql) ProgrammingError: SQLite   objects created in a thread can only be used in that sa me thread.The   object was created in thread id 15108 and this is thread id 14488   This has something to do with thread permissions sqlite3. But I am not sure what could I do additionally to get it working.  Individually out abcd.py works perfectly fine when called into other code.
I have a Python program that uses the "threading" module. Once every second, my program starts a new thread that fetches some data from the web, and stores this data to my hard drive. I would like to use sqlite3 to store these results, but I can't get it to work. The issue seems to be about the following line:  conn = sqlite3.connect("mydatabase.db")    If I put this line of code inside each thread, I get an OperationalError telling me that the database file is locked. I guess this means that another thread has mydatabase.db open through a sqlite3 connection and has locked it. If I put this line of code in the main program and pass the connection object (conn) to each thread, I get a ProgrammingError, saying that SQLite objects created in a thread can only be used in that same thread.   Previously I was storing all my results in CSV files, and did not have any of these file-locking issues. Hopefully this will be possible with sqlite. Any ideas?
I accidentally opened Orca Screen Reader from the Dash when I was trying to open Screenshot. Now everything I type or click on is spoken out loud.  How do I make it stop?  For reference, here is a screenshot of Orca Screen Reader running: $X/{\sim}$ is Hausdorff if and only if $\sim$ is closed in $X \times X$ $X$ is a Hausdorff space and $\sim$ is an equivalence relation.  If the quotient map is open, then $X/{\sim}$ is a Hausdorff space if and only if $\sim$ is a closed subset of the product space $X \times X$.  Necessity is obvious, but I don't know how to prove the other side. That is, $\sim$ is a closed subset of the product space $X \times X$ $\Rightarrow$ $X/{\sim}$ is a Hausdorff space. Any advices and comments will be appreciated. The answer to tactical downvoting problem? As we know, the tactical downvoting (I'm talking especially about SO, as I don't know about other sites) is more and more becoming a serious problem, as I see, the community can't stop this behavior without some sacrificing.  As a suggestion, I think it makes sense to prevent an answerer from downvoting any answer on the same question, this -sure- has a harm, but IMO, it's less harmful than the tactical downvoting issue, and to make the things a bit more easier, we can prevent an answerer from downvoting a question without posting a comment to that answer before.  And vice versa, if a user downvoted an answer, he shouldn't be able to post another one unless he posted a comment first, to prevent working-around that system, so a user can't downvote other answers before posting his own to avoid posting comments.  EDIT, more clarification: I don't say wrong answers shouldn't be downvoted, BUT if you want to downvote an answer and post your own, you'll have to post a comment, so we make sure you're not just downvoting right answers tactically. How do I get a Cron like scheduler in Python? I'm looking for a library in Python which will provide at and cron like functionality.  I'd quite like have a pure Python solution, rather than relying on tools installed on the box; this way I run on machines with no cron.  For those unfamiliar with cron: you can schedule tasks based upon an expression like:    0 2 * * 7 /usr/bin/run-backup # run the backups at 0200 on Every Sunday  0 9-17/2 * * 1-5 /usr/bin/purge-temps # run the purge temps command, every 2 hours between 9am and 5pm on Mondays to Fridays.   The cron time expression syntax is less important, but I would like to have something with this sort of flexibility.   If there isn't something that does this for me out-the-box, any suggestions for the building blocks to make something like this would be gratefully received.  Edit I'm not interested in launching processes, just "jobs" also written in Python - python functions. By necessity I think this would be a different thread, but not in a different process.  To this end, I'm looking for the expressivity of the cron time expression, but in Python.   Cron has been around for years, but I'm trying to be as portable as possible. I cannot rely on its presence. I was having a discussion with a friend of mine about some normal group properties and then came up with the question "if G is not commutative, then is there always a subgroup that is not a normal subgroup?" It's probably more easy to solve this in the following form:$$\forall H \leq G : H  \lhd G \Rightarrow \forall a,b \in G : ab=ba$$ My question is, can anybody give a proof, or a counter-example (because I don't think it holds) of this theorem? Thanks! Let $R$ be a finite ring with unity. Prove that every nonzero element of $R$ is either a unit or a zero-divisor. Schengen visa. What qualifies as main destination? I'm planning a multi city trip soon. I'll be applying with the German embassy as I had planned on going to Berlin for 3 days before going to Prague, Vienna, and Budapest for 2-3 days each afterwards.   My question is, it is working out more conveniently for me to instead make Germany my last destination, rendering the first entry clause. And I can only apply with the German consulate as they are the only ones I can find an appointment for in time. Would staying in Germany for 4 days afterwards be enough to classify it as a main destination (as opposed to 2-3 days in the other cities)? Auto size image to page size in InDesign I've got an InDesign document with 100 A4 pages.   I've got 100 assets (a mixture of .jpg and .pdf files) and I want to place 1 per page. If an image is not the proportion of the A4 page I would like to get it as big as it can be on the page before it hits into the margin. Ex. if it's a portrait image it should be as large as it can be before hits the top/bottom margin. If it's a landscape image it should be as large as it can be before hits the left/right margin.   At the moment I'm dragging each file across and resizing them manually. Is it possible just drop them on the page and get them auto resized ? Let $f$ be a holomorphic function in $H={\{z\in\mathbb{C}}:\Re(z)&gt;0\}$ such that it is continuous in $cl(H)$, $|f(z)|\leq1$ $\forall z\in \delta H$ and $\lim_{|z|\to\infty}f(z)=0 $. Prove that $|f(z)|\leq1$ $\forall z\in H$. I thought about taking the bounded set $H\cap D(0,R), R&gt;0$. This way we could use the maximum modulus principle to prove it but I do not really know how to relate it with the limit since I would need $|f(z)|\leq1$ $\forall z\in H\cap D(0,R)$, and I do not have it on $D(0,R)$. This is similar to , but I believe it's a bit different*.  Sites like GMail support a preference that pushes all traffic through the SSL edition of the site rather than the plain-text protocol.   For sites that don't offer such preferences (or ones that may, but I have been unable to find, like facebook), is there a way using only the browser (perhaps with a plugin or addon) to always try SSL first, and fall-back to plain-text iff SSL fails?  Is that solution available on Windows, Mac OS X, and Linux? Just one?     * The previous question was looking for external applications that would accomplish this goal. I have a sword that currently rotates around a pivot point thats off of the actual object. Im new to blender and im not sure how i would go about changing it so that the sword rotates around the handle. Any help would be appreciated! Inequality ${n \choose k} \leq \left(\frac{en}{ k}\right)^k$ When I ordered this TP-Link AC1300 Wireless Dual Band PCI-Express Adapter (Archer T6E), I looked into customers reviews and they said it worked fine with no drivers on Ubuntu. I didn't have a CD/DVD player on my desktop so I (on a laptop with a DVD drive) copied and pasted the DVD support disk content on to a USB drive and used that. But when I tried to run autorun.exe it puts up archive manager and says An error occurred while loading the archive Ubuntu verison- Ubuntu 16.04 LTS.  Output from: lspci -vnn  02:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 11) Subsystem: ASRock Incorporation Motherboard (one of many) [1849:8168] Kernel driver in use: r8169  Kernel modules: r8169   I am fairly new to Ubuntu (1 month) and have learned alot (sudo commands) and now know that windows is overpriced and that ubuntu is better in most fields.  Thanks for the help. UK visa type to attend conference and training in London Related posts display randomly by tag I would like to ask that what code should i add in order to make my related posts by tag to display randomly? I got this code from somewhere else.  &lt;?php $orig_post = $post; global $post; $tags = wp_get_post_tags($post-&gt;ID); if ($tags) { $tag_ids = array(); foreach($tags as $individual_tag) $tag_ids[] = $individual_tag-&gt;term_id; $args=array( 'tag__in' =&gt; $tag_ids, 'post__not_in' =&gt; array($post-&gt;ID), 'posts_per_page'=&gt;5, // Number of related posts that will be shown. 'caller_get_posts'=&gt;1 ); $my_query = new wp_query( $args ); if( $my_query-&gt;have_posts() ) { echo '&lt;div id="related"&gt;&lt;h4&gt;Related Posts&lt;/h4&gt;'; while( $my_query-&gt;have_posts() ) { $my_query-&gt;the_post(); ?&gt; &lt;div class="ncc"&gt; &lt;h5&gt;&lt;a href="&lt;? the_permalink()?&gt;" rel="bookmark" title="&lt;?php the_title(); ?&gt;" rel="nofollow"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h5&gt; &lt;?php the_excerpt(); ?&gt;  &lt;/div&gt;&lt;!--ncc--&gt;  &lt;? } echo '&lt;/div&gt;&lt;!--related--&gt;'; } } $post = $orig_post; wp_reset_query(); ?&gt;   Any solution? Thanks! When computing the covariance matrix of a sample, is one then guaranteed to get a symmetric and positive-definite matrix?  Currently my problem has a sample of 4600 observation vectors and 24 dimensions. When to use "Well" or "Good" I would like to see a breakdown of reputation by post type on the user summary page.    This would help show, at a glance, how much someone actually knows vs. how good they are at asking questions.  For instance:     Reputation from Questions - 10,015 from 1024 posts   Reputation from Answers - 110 from 11 posts   Reputation from Edits - 400 from 1000 edits     I would take any answers the above person gave me with a grain of salt instead of assuming they were knowledgeable because they have 10k rep.  We already have a multitude of other readouts on the new page, so this shouldn't up the clutter factor too much either. How can I make a directory on the desktop?  I tried cd /desktop command but it gives an error  no such file or directory.  What's the correct command? Why does my query run fast in Environment A, but slow in Environment B? I have a piece of SQL that seems to run really fast in Environment A, but the exact same query runs really slow in Environment B!  Environments are supposed to be the same, so what should I do and/or where should I look in order to see why the query doesn't perform the same?