I want to perform various Linux commands/operations using python script. I will be using the output, verifying/processing it and continue with some more commands execution in my script, may be remote execution also sometimes.  I have tried with both os and subprocess modules. The caveat here is, I am not able to combine both of them i.e. system calls or commands executed from one module does not affect "program/python" environment variables rather only considered by that particular module.  For. ex.   os.chdir(dirname) os.system(cmd) # p = subprocess.Popen(cmd)   Now, here changes from os.chdir are not useful for subprocess call. We have to stick with any one of them. If I use subprocess, I have to pass/create shell commands for it.    Added: cwd= is a solution for subprocess.Popen but every time I would have to pass option cwd as argument to future commands, if they all should be run from that dir    Is there a better way where we can use both of these modules together?  Or  Is there any other better module available for command executions.  Also I would like to know "Pros-Cons/Caveats" of both these modules.
How do you call an external command (as if I'd typed it at the Unix shell or Windows command prompt) from within a Python script?
Make square image Fatal error: Class 'SelectQuery' not found in includes/database/database.inc on line 813 Fatal error: Class 'SelectQuery' not found in /home/content/71/11241671/html/drupal/includes/database/database.inc on line 813   We built a site in a subfolder called /drupal while building the site, and then moved the files to the root directory when we were finished but it gave the above error on a WSOD.  I have tried:    flushing the cache before moving  tried the registry rebuild truncating and replacing the registry and registry_file tables with a fresh install copy, and rebuilding the registry again rewrite base in htaccess setting a new base url in settings.php   But nothing has worked.  The second we put the files back into the /drupal folder, it works again. It also looks like the error mentions the file in the /drupal directory, which isnt there anymore.   This is on 7.37   Anyone have any ideas? Why is rendered viewport faster than rendering individual frames? When I'm using rendered viewport it initially takes a while before rendering starts, but once it does, I can freely move around and rendering a new view happens almost instantaneously. When on the other hand I'm rendering a movie, for each frame Blender takes a significant amount of time before rendering even starts, usually doing the following:  Synchronizing object, Updating images, Updating meshes, Updating Scene BVH, Packing BVH,  Why does it do this? And is it possible to disable this to increase movie rendering speed? Postgres JDBC connection in Eclipse Help I'm trying to get a postgres jdbc connection working in eclipse. It would be nice to use the Data Source Explorer, but for now I'm just trying to get a basic connection. What I have done so far is download the postgres JDBC connector. I then tried two different things. First, Preferences-> Data Management, I tried to add the postgres connector. Second, I added the jar to my project and tried to load the driver using Class.forName("org.postgresql.Driver"); but neither worked. Does anyone have any ideas?  Thanks,    Charlie Can a lambda function call itself recursively in Python? A regular function can contain a call to itself in its definition, no problem.  I can't figure out how to do it with a lambda function though for the simple reason that the lambda function has no name to refer back to.  Is there a way to do it?  How? Figure subfigure layout with different numbers Ampscript date range lookup I want to use LookupOrderedRows and return rows between a start and end date (last month range). What is the best way to handle using Ampscript?   I can add one date to the where using   "DateField", @varStartDate,   But if I add the below to add additional where filters  "DateField", @varStartDate,"DateField", @varEndDate,   I get this error:     "Duplicate Key Field Name: DateField"   EDIT: Also I tried the range as the var for the LookupOrderedRows using   set @strRange = StringToDate(Format(DateDiff(@strStartDate, @strEndDate, "M"),"MM/dd/yyyy"))  and then in the LookupOrderedRows just using  "DateField", @strRange  But that got an error as well. Exporting multi layered Illustrator to Photoshop Is there a particular reason that using clone = obj *1 is avoided when "cloning" objects? I have a Dell N5110 laptop with integrated Nvidia GeForce GT 525M and an Intel HD Graphics 3000 card; My problem is the default card is the Intel one, and it provides a very bad performance with Windows 8. So can I force to use the Nvidia one all the time including "Desktop Windows Manager" ? Suppose $z\neq -1$ is a complex number of norm 1m $(|z| =1)$. I know that $z= n + mi$, what is the most straightforward way of solving this problem? I was also given the following sketch for a possible approach. Now that experience does something besides render regions of a server uninhabitable due to  orb lag, what's the most efficient and safe way to get those excellent enchants?  A mob farmer may rank highly, but what about without tons of setup? $\{\emptyset\}$ is a set containing the empty set. Is $\{\emptyset\}$ a subset of $\{\{\emptyset\}\}$?  My hypothesis is yes by looking at the form of "the superset $\{\{\emptyset\}\}$" which contains "the subset $\{\emptyset\}$". Why is "our today's meeting" wrong? One of the answers to  question states that &quot;We shall discuss it in our today's meeting&quot;  is grammatically correct. To me, that sentence is clearly wrong. While in today's meeting is fine and in our today meeting is OKish (though at the very least clumsy), there's something about the possessive there (our today's) that makes it wrong for me. I would read that sentence as in our today's (as opposed to your today's) meeting. Similar to in our car's trunk where the our clearly modifies car and not trunk or car trunk, the our in our today's seems to be modifying today's and not meeting. So, my questions are i) is it actually grammatically wrong to say in our today's or is it just a question of usage? and ii) if it is indeed wrong, how can we explain its wrongness? How is momentum conserved in this example? This came up to me while I was reading the question about Magical being using firearms in battle to raise their power (which I think I have a good answer for, but it's too long to fit in this question... and it would also be inappropriate).  Anyways, I was reading it and then the following thought came into my mind: If wizards decided to use guns on their battles (the ones agains Voldemort for instance), that would create that opening for much bigger battles than we see in the books (after all even a muggle can fire a gun, so lots of guns + the Imperio curse, and presto manifesto (is that racist? talking about wizards and all) you have yourself an army). Those kinds of battles, however, would most definitely not go unnoticed by the muggles - even though they wouldn't be able to link it to magic.  Well, that thought brought up my one and final question, which I bring forth to you guys. Is there any mention on how the Wizards and Witches viewed the two world wars (which had taken part by the time Harry got to Hogwarts, and which he had probably heard about in muggle school), and what was the Wizards' part in it? What about the cold war? Did the magical world even recognise the existence of weapons such as nukes, which could render all life on earth extinct?  EDIT  DVK has brought up an  regarding the connections between the Second World War and the wizarding world (more specifically, the wizard Grindelwald). Although it doesn't fully answer my question, it does help by showing that there was indeed some form of connection between the two world at the time. Can White Walkers talk? Through all the five seasons of Game of Thrones we had never seen a White Walker talking.  Does this mean they can't talk human language (e.g. they have their own language) or we will never see them talking (i.e. they can't talk at all)? Travel to Romania with a residence permit of Germany I am a student in Germany and i have a residence permit here for 2 years, which is also a Schengen visa, I suppose. Do I need a separate visa if i wish  to travel to Romania? Regionalism or just bad English? I've encountered a particular type of writing occasionally and it being, derp, in writing, it's hard to tell whether there's an accent behind it. The English used seems to me to be simply incorrect, but I can't help but feel that the following features are part of a dialect or a regional style of English. One of the most glaring (and grating) features is the substitution of &quot;saw&quot; with &quot;seen&quot;.  He seen him at the shop the other day. I seen that you were looking for... etc.  The use of &quot;away (to)&quot; is also peculiar, if not incorrect.  He was away to open the door when... He was away to get what he had asked for. etc.  I haven't come across these forms very often, and even then it was accompanied by otherwise mostly correct English, which is what makes me wonder what the hell. This is more intellectual curiosity than anything else. If Newton's third law is true, why can we sink in sand? Newton's third law of motion states that every action has an equal and opposite reaction. That is the reason we do not sink into the earth, because when our weight exerts a force on the earth it also exerts an equal and opposite force on us.  But when we stand on quicksand or on fluids we can sink in. How is this possible? Does it not exert an equal and opposite force on us? Or are Newton's laws different in the case of fluids and substances of low densities?