Edit: TL;DR: Not the Code itself is the problem, the error message is. (Look at the picture/link)
I'm new to programming. Straight to the point: I cannot run my program because of "& cannot be processed syntactically at this point" and i really don't know how to fix it. I already tried a new debugger, reinstalled all expansions, uninstalled VS Code with everything and reinstalled it "clean"... and it still won't work. I searched for hours now... and I still didn't find a solution to this problem.
Btw.: I had first written the whole program on my calculator in math class and it worked perfectly fine, after that I copied it in into VS Code and now it doesn't work. The calculator uses MicroPython v1.9.4
The code, if it's needed, I originally tried (and where the same probleme occurs) is:
import math
def v(a1,a2,a3,b1,b2,b3):
ma=a1*b1+a2*b2+a3*b3
if ma==0:
print("Orthogonal")
m1=math.sqrt(a1**2+a2**2+a3**2)
m2=math.sqrt(b1**2+b2**2+b3**2)
cosg=ma/(m1*m2)
g=math.acos(cosg)/math.pi*180
if g>90:
g=180-g
print(g)
x=a2*b3-a3*b2
y=a3*b1-a1*b3
z=a1*b2-a2*b1
print("N(",x,"|",y,"|",z,")")
As I said: I'm new and I'm very excited to learn programming and all around it. So i would be very thankful if someone can help me.
View of an easy probleme, where the same error occurs
Related
I have written quite a complex program in Python 3.7. However I am looking for a way to reduce (and later on expand again) my already functional functions. So that I don't have to scroll over 200 lines of code whenever I want to get back to the top.
As I said, I am writing my code in Python 3.7 and this seems like a pretty easy/beginner technique. However, I tried googling a lots of stuff, unfortunately English is not my native language and I have no idea of what to google. And googling for "reduce code in Python" ain't gonna work me. Thus I am hoping you Geeks could help me! :)
E.g.
Instead of
1 # This is some random code
2 print("Hello")
3 print("beautiful")
4 print("World")
5 # This is some random code
I want to have
1 # This is some random code
2-4 # Here all the other lines should be reduced to one line
5 # This is some random code
Utilize code folding in an IDE. Suggested IDES for Anaconda can be found here. I'd recommend Visual Studio Code.
I'm working on adding an image to a GUI interface using Tkinter. In order to eliminate as many factors as possible, I have stripped out everything but the parts relevant to adding an image, yet it still errors out with "tclError:image "pyimageX" doesn't exist" (where X a number). I have followed directly from a tutorial, and I've checked and double checked the file name, and that the file is directly inside the same folder as the program. I have no other ideas to check, and thus, here I am. Thanks for any help you can provide, I'm really hoping I'm not missing anything obvious.
Here's the snippet that's not working:
from tkinter import *
root =Tk()
versionNumRaw = PhotoImage(file="versionNum.gif")
versionNum = Label(root,image=versionNumRaw)
versionNum.pack()
root.mainloop()
Forgive me, as I know this sort of error has been posted before, with answers that have worked for others, but me, still being not having much experience with programming, cant figure out how to apply the answers others have gotten to my own case.
It is not obvious to me how to use RopeVim's code assist feature.
I was using Vim at the terminal in mac os x.
I moved to MacVim and the GUI does help b/c I do see a Ropevim menu option now.
I have Ropevim set up correctly I'm fairly sure.
I want to test the code assist feature out, so I type in self.asser
and nothing happens. I've tried tab and control + space.
I sometimes see basically a history of what I've typed, more along the lines of auto-complete, b/c I have a plugin for that, but I want to see that code assist shows me what possible options are.
When I type in from django.contrib.
I want to know if code assist will be able to show me things like mail, syndication, etc, modules that I've never even typed in this project before.
Of course pycharm certainly does this flawlessly, but I am still partial to vim. Can't quite let it go, but most definitely can not afford the time to continue to fiddle with this tinkering b/c I need to get coding. The Rope library seems like it can do what I need: code assist and basic refactoring, but how?
I use jedi-vim and code assist works perfectly. https://github.com/davidhalter/jedi-vim.
Update:
I uploaded a short video. http://youtu.be/5lgbV8iY8-Q
Did you look at the code? Code assist seems to be mapped to <M-/>.
I've tried to find some help with online searches and wasn't able to find anything so I'm posting on here and hoping. I've got a bunch of code with 3 "for" loops and a try/except statement inside of the 3rd "for" loop. I run the module from IDLE and it runs fine for about 16 hours then just quits and prints on the IDLE command screen =====Restart====. It does this randomly so I can't replicate it but I've gone through by hand and was able to process the data that it quit on without a problem. Does anyone know of a way to have python email myself when this occurs? I've tried putting the main code inside of a definition and use a
try:
definition
except:
send email
but this doesn't work either. I've got the emailing part of the code working fine. I apologize that I am not including the code here. I've talked to my boss about it, but since it is dealing with sensitive data I'm not allowed to. Any guidance that you can provide would be greatly appreciated.
Thanks
I understand the question might well be too vague, but just in case anyone seen this or can have any clues. I have an application which works just fine under python 2.5.1. But when running it on Python 2.5.4, it starts giving "NoneType is not callable".
I have checked changelogs between the versions, but there are quite a few changes, and it's really hard to say what might be related.
Can you give any hint please where to start digging further?
EDIT: Clearly something is None, but the question is why it is not None under 2.5.1. I was hoping that there is a good known issue for this, so that this question might hit it.
EDIT 2: It has just become clear that the error occurs when trying to import win32com.client. Any clues how to work around it?
I'm posting this answer on behalf of an "Anonymous user" (presumably the OP who had not logged in properly?!) who had written this as an edit to the question (edit got rejected because it should have been posted as an answer -- which is what I'm doing now).
EDIT 3 (and answer): Done. It turned out that win32com.client couldn't be imported more than once within the same process. And even for the first import it was necessary to regenerate the COM cache and make sure it's not read-only. We have worked around it by not using win32com at all, as it appeared it was only needed for MSXML. The XML processing was rewritten by using python's standard library xml.sax.
The place to start digging is your app. The error message is telling you some variable is None when you think it should point to an object. So, find that variable (the error message should tell you exactly where it is), then figure out why that varianle contains None.
There's a good chance your code is either silently catching an error, or it's making some assumption that is false. Find that error or assumption, and work backwards from there.