No matter what programme I write , it is showing invalid syntax. Eg. If I write a=45 print(a), it says name a is not defined? - syntax-error

a= 45
print (a)
It starts saying name "a" is not defined
What to do?
Even if I copy code from somewhere and paste then it says invalid syntax..
Even if I type in everything correct, the response is same as invalid syntax.

Write it in two lines code
a=45
print(a)

There could be 2 simple reason for this error
First reason:
You could been writing in another file not the .py file, for example, it will give you error if you're file is a .css or .html or .js or .java etc.
Second reason:
It could be an error writing in a line for example it should be
a = 45
print (a)

Related

Reading .mpr/.mps/.mpt files with pd.read_csv

I'm trying to read some .mpr, .mps and .mpt files with Pandas and my professor told us to use pd.read_csv to open them. When I try to do this using: pd.read_csv(path+filename, delimiter='\t', header=55) I get the following error consistently:
ParserError: Error tokenizing data. C error: Expected 1 fields in line 9, saw 2
If I use skip_rows I can circumvent this problem and display the column names of the file, but no data appears. I know the file isn't empty so I'm wondering why this is happening.
Thanks!

LESS Compiler: Unexpected token u

When I attempt to compile a LESS template in Visual Studio using Web Essentials, I receive an error that says "Unexpected token u" with no file name, no line number, and no column number. Why is this happening?
Go to %USERPROFILE%\AppData\Local\Microsoft\VisualStudio\12.0\Extensions which is the folder where per-user Visual Studio extensions reside. WebEssentials will be located in a subfolder with a randomly generated name.
From inside the WebEssentials folder, open up the file Resources\nodejs\tools\server\services\srv-less.js and go to line 65, which reads:
map = JSON.parse(output.map);
The problem is source map output may be the undefined value. JSON.parse can only parse strings, so it casts that to the string value "undefined" before parsing, but JSON does not recognize that as valid token. (It only understands the null value, not the undefined value.)
So... change line 65 to read:
map = JSON.parse(output.map || "null");
And voilĂ ; LESS compilation on files with empty output works again.
Source:
https://github.com/madskristensen/WebEssentials2013/issues/1696
From my experience, this error occurs when LESS attempts to output a CSS file from a LESS file, and the resulting CSS file is empty. In my case, this happened after removing some font-face declarations, which left the resulting CSS file empty. LESS would not compile until I added a class that would output to the CSS file.
Details may be found here: https://github.com/madskristensen/WebEssentials2013/issues/1696
I'm adding this to StackOverflow because I'm unable to access Github at my workplace. I hope this helps someone.
You can also add in your less file an important comment /**/ or #charset "utf-8"; as described here https://github.com/madskristensen/WebEssentials2013/issues/1696

Trying to read in a .gda file to IDL

I am trying to read in a .gda file into IDL for plotting purposes. I am not familiar with the format and my research indicates it is an unformatted binary data file type. Anyways, here is what I am doing:
pro omidi_contour
openr, 1, 'data.gda'
a = fltarr(128,128,128)
readu, 1, a
close, 1
end
However when I look at the variable definition at the left panel of IDL, it indicates that a is 'undefined'. When I try to print:
print, a[0,0,0]
I get:
Variable is undefined: A
How can I solve this?
I found out that there was nothing wrong with my program. It was reading the right values from the file. However, the IDL "forgot" the value of the variables once the program was done. Solution: DO not run this as a program i.e. remove the following lines:
pro omidi_contour
end
This makes the code to run as if each line were typed into the IDL prompt and IDL does remember the values this time round.

Error trying rename a file

Hi community!
I have an application in VB.Net, in the user's computer is located in program files.
The users run always the program as an Administrators.
But in some cases; when the program try to rename a file in the program files the program throws the following exception:
The given path's format is not supported.
SOURCE = System.Security.Util.StringExpressionSet.CanonicalizePath
Also, happens when I try to copy a file.
The application does the rename or copy automatically and it's the same name for all the users
Example:
Rename(vOld, vNew)
FileCopy(vOld, vNew)
This exception only happen in Win7.
Somebody have an idea what is the reason to some users appear this exception?
This will happen when the user provides an invalid file name, for example one that includes colons.
You should validate that the user-entered file name does not contain any of the values in System.IO.Path.GetInvalidPathChars.
All it's my fault!
-_-'
I'm trying to rename this path:
C:\_MyFile.xlsx
To:
C:\MyFile.xlsx
In my computer all works fine because I have the both files (The users only has the file with the underscore).
When the program try to validate it try to rename the file "_C:\MyFile.xlsx" to "C:\MyFile.xlsx"
The exception don't give much information about my error...

SQL Server Database Attach error. The system cannot find the file specified

When im trying to attach database get such error Does Anyone have an idea what can be problem?
On your first picture, I see the med_log.ldf file. On second picture you trying to attach med.ldf. Try to change the name of file in line 3 to med_log.ldf.
Your error message states that it is looking for Med.ldf, not Med_log.ldf.
You need to change the filename in the second part of your restore command to match this filename.
The name of the Log file seems to be incorrect. it should be "Med_log.ldf" instead of "Med.ldf"