Folder Structure:    main    |__ sub1       |__ __init__.py    |__ sub2       |__ test.py   I need to import inside test.py:  from .. sub1 import SomeClass   It shows this error :     ValueError: attempted relative import beyond top-level package.   Thank you for responses.
Imagine this directory structure:  app/    __init__.py    sub1/       __init__.py       mod1.py    sub2/       __init__.py       mod2.py   I'm coding mod1, and I need to import something from mod2. How should I do it?    I tried from ..sub2 import mod2 but I'm getting an "Attempted relative import in non-package".  I googled around but found only "sys.path manipulation" hacks. Isn't there a clean way?      Edit: all my __init__.py's are currently empty    Edit2: I'm trying to do this because sub2 contains classes that are shared across sub packages (sub1, subX, etc.).  Edit3: The behaviour I'm looking for is the same as described in  (thanks John B)
Preventing itemize environment to insert initial vertical space Assuming I have a Czech license and break a minor law in Germany which incurs me a certain number of "violation points" (e.g. speeding), would those points be eventually transferred to my Czech license? I would obviously have to pay the fine (either on the spot or by mail), but it's not clear if EU countries exchange data on traffic points.  I would limit the scope to EU/EEA license holders driving within the EU/EEA, to avoid an overly broad question. Also assume that the person in question is resident in his home country and is only visiting other EU/EEA countries as a tourist. Is there really a way to make a true toon shader material in Cycles? Toggle wireframe mode with hotkey How do I toggle in and out of wireframe mode with my keyboard? Is there a hotkey for this?  I'm a beginner (obviously). I thought I could find this in the "view" menu, but it either doesn't exist or I have horrendous eyesight. Thanks! Delete Everything(the rest of the text) after a specific string Why do some materials reflect (metals) and other materials reflect and refract (glass) from the quantum perspective? Recently I was asked to explain the difference between reflection and total internal reflection from a purely conceptual standpoint (no math).    Let me explain what I already know.  Reflection and refraction at the quantum level are the same thing.  Light is a photon.  A photon is a discrete particle that has wave characteristics (a finite wave traveling like a bullet).  As the photon travels it collides with electrons in the matter of the medium it is traveling in.  Depending on the energy of the photon and the allowed energy bands of the medium the photon cause the electron to jump up a level.  If the photon is absorbed then the medium will increase its motion (at the macro scale increasing its temperature).  If the photon is not absorbed it will be re-emitted (really as a new photon). I have read and watched Feynman's QED lectures and book and have a pretty good understanding of his process for determining how all these paths come together to give the net path of the photon.  The general rule of thumb is that the photon wants to take the path which requires the least amount of time.  I understand how this principle goes to explain refraction and reflection.    What I don't seem to understand is why does one material seem to cause a higher percentage of refraction compared to another (metal vs. glass).  What about the electron configuration of a the medium changes the net effect of the absorption and re-emissions of the photons?  Is there a change in the probability of the photon being re-emitted in a reverse direction?  Is there a farther distance the photon can travel before being incident onto an electron?  This is the part where my understand breaks down.    When you have hit the critical angle in a medium that refracts and the light completely reflects, are the photons moving is the same manner as they would be in a material that always reflects? How does this connect to the question in the previous paragraph?  I know I have a bunch of mini questions embedded in answering this one larger question.  Any help on any of the parts would be greatly appreciated? How do I troubleshoot the "Error, press shutter release button again" message on my Nikon? The LCD on my Nikon D3000 is displaying the following error message:     Error. Press shutter release button again.   I have pressed the shutter release button but the camera still does not work. I'm experimenting with VPNs, so I wanted to install pptpd.  john@desktop:~$ sudo apt-get install pptpd [sudo] password for john:  &lt;snip&gt; The following extra packages will be installed:   bcrelay The following NEW packages will be installed:   bcrelay pptpd 0 upgraded, 2 newly installed, 0 to remove and 11 not upgraded. Need to get 90.5 kB of archives. After this operation, 442 kB of additional disk space will be used. Do you want to continue [Y/n]? y   And everything runs fine until I get down to here:  WARNING: The following packages cannot be authenticated!   bcrelay pptpd Install these packages without verification [y/N]? n E: Some packages could not be authenticated   No authentication?  I'm no security expert, but I'm fairly sure that's a bad thing.  So I .  john@desktop:~$ apt-cache policy pptpd pptpd:   Installed: (none)   Candidate: 1.3.4-3ubuntu1   Version table:      1.3.4-3ubuntu1 0         500 http://us.archive.ubuntu.com/ubuntu/ natty/main i386 Packages john@desktop:~$ apt-cache policy bcrelay bcrelay:   Installed: (none)   Candidate: 1.3.4-3ubuntu1   Version table:      1.3.4-3ubuntu1 0         500 http://us.archive.ubuntu.com/ubuntu/ natty/main i386 Packages   They're coming from Ubuntu.com and not being properly authenticated?  What's going on here? $\lim_{h\to 0}\int \frac{f(x+h)-f(x)}{h}\,\mathrm{d}x = f(b)-f(a)$ Let $f:[a,b]\to  R$ be integrable and continuous on $(a,b)$. Prove that: $$\lim_{h\to 0} \int_a^b\frac{f(x+h)-f(x)}{h} \,\mathrm{d}x = f(b)-f(a).$$  What I've tried so far: make a change of variables, which didn't help. I also thought of using the intermediate value theorem inside the integral, but the function being differentiable is not specified. Any help, tips? Thanks in advance! Since my previous questions were not answered I will try to ask again more precisely.  I previously had the Nvidia driver installed and working correctly.  Then the ubuntu software update did something which broke it.  In fact, it completely de-configured it so that the standard display driver is used when the computer reboots.  I would like to re-enable the existing Nvidia  driver without re-installing the Nvidia driver.  How do I do that?  This machine is no longer connected to the internet.  NOTE: I am not asking how to disable automatic updates in this question.  I asked that elsewhere (and it wasn't answered).  NOTE: I am not asking how to stop the Ubuntu software updater from breaking the Nvidia driver the next time it updates the system.  That would be nice to know, but I asked that already and did not receive the correct answer either.  NOTE: Please don't make this as duplicate simply because someone else asked a question about Ubuntu and the software updater.  Try to read the actual question and see how it's different and try to realize how annoying it is when users have to spend hours of their own time to correct the problems that other people causing by incorrectly designing software updaters. Occasionally, I've come across a webpage that tries to pop open a new window (for user input, or something important), but the popup blocker prevents this from happening.  What methods can the calling window use to make sure the new window launched properly? is it possible to skip immediately preceding time points? So that, if, for example, you are using model order 2, that is, two time points, but not the two immediately previous time points, but rather, say for example, skipping 2 points, and then using those two points.  So, e.g., it would be y=x(t-3) + x(t-4). Is there a JavaScript equivalent of Java's class.getName()? I'm reading .     The graph of $f: A \rightarrow B$ is the subset of $A × B$ consisting   of all ordered pairs $(a, b)$ with $f (a) = b$. If $A$ happens to be   $B^n$ for some $n ∈ N$, then we say that $f$ is a function on $B$ and   $n$ is the arity of $f$.   I don't understand the notation for the exponent of a set, I'm aware of what  is, it's the number of arguments or operands the function takes. I'm just not so sure if I can assume that a set with an exponent such as in $B^n$ means that a function has two operands.  I know the question may be too naive and perhapes the answer is the one I suggested and it's right in front of my face, I'm just searching for a confirmation or the negation of it. Thanks. Finding the radius of a third tangent circle Sorry if this is a foolish question, but I'm having difficulty understanding how to solve for $r_3$ in the following diagram...    According to WolframAlpha's page on tangent circles, the radius of $c_3$ can be calculated using the following formula $r_3=\frac{r_1 \times r_2}{(\sqrt{r_1}+\sqrt{r_2})^2}$, which can be simplified to $\frac{1}{\sqrt{r_3}}=\frac{1}{\sqrt{r_1}} + \frac{1}{\sqrt{r_2}}$.  To be completely honest, I'm having a hard time understanding understanding how this formula works (as I'm a very visual person). What exactly is happening here? I have an HSA that allows me to invest the money in the account in the stock market. Any money not invested is available to be used for health expenses. I currently have ~50% of the total balance of the HSA invested, with the other ~50% on hand for expenses.  I've run into a situation where the ~50% on hand for expenses does not cover all of my current expenses. To cover the remaining costs, should I sell off my the HSA investments or should I leave those as is and use money from my savings account?  I'm trying to determine if the tax advantages of the HSA combined with the returns the invested money is seeing is worth me leaving that money alone - and instead, take the money from my savings account to cover the costs. How to show that  $$ \lim _{\alpha \rightarrow \infty } \sup_{t \in \left [0,T \right]} \left | e^{-\alpha t} \int _ 0 ^t e^{\alpha s} ~ dB_s \right | =0, \ \ \text{a.e.} $$  where $\left (B_s \right)_{s\geq 0}$ is a real standard brownian motion starting from zero ? MATLAB/OCTAVE Extracting elements from different sized vectors in a cell array Is a capacitor in an open circuit charged? Say I have a circuit consisting of a battery, a wire, an open switch, and a capacitor. The circuit is open since the switch is open.  My book says that the capacitor will only be charged when the switch is closed, but I don't see why this is true. I would expect the capacitor to be charged a little - not as much as if the circuit is closed, but still charged none the less.  To further illustrate my point consider this: If the circuit is open, the current must be zero. Consequently the field must be zero. For the field to be zero, the capacitor's field must cancel out the battery's field. Therefore the capacitor must be charged.  Generalizing this concept, shouldn't capacitors be charged (to a lesser degree) in open circuits?  EDIT: In other words, if the field is zero, the capacitor must be charged to cancel out the field of the battery. How to install LXDM instead of GDM3? I'm running Debian Wheezy and my default Display Manager is GDM3, and I would like to replace it with LXDM. The problem is that I'm trying to run # apt-get install lxde and it's not working, what am I doing wrong?  My /etc/apt/sources.list is:  deb cdrom:[Debian GNU/Linux testing _Wheezy_ - Official Snapshot i386 DVD Binar$  deb http://ftp.br.debian.org/debian wheezy main deb-src http://ftp.br.debian.org/debian/ wheezy main  deb http://security.debian.org/ wheezy/updates main contrib deb-src http://security.debian.org/ wheezy/updates main contrib