Scripting languages execute the line which has an error and don't output anything or it don't execute it at all? - scripting

Do scripting languages execute the line which has an error and don't output anything or it don't execute it at all?
Like what is the process when scripting languages have an error line in the code?
I know it doesn't execute it right or wrong?

That depends on the nature of the error. (It also might depend on the language or interpreter.)
If the line has a syntax error (or other error that the interpreter treats similarly), the interpreter will almost certainly not execute the line. In fact, it might not execute any lines. (It's possible that an interpreter could 'repair' a syntax error and then execute the line, but I don't think that's common.)
If the line has a different kind of error, the interpreter will execute the line until it encounters the error.

Related

PyCharm Selenium not openening Chrome, "Process finished with exit code 0" [duplicate]

I am new to PyCharm and I have 'Process finished with exit code 0' instead of getting (683, 11) as a result (please see attachment), could you guys help me out please? Much appreciate it!
That is good news! It means that there is no error with your code. You have run it right through and there is nothing wrong with it. Pycharm returns 0 when it has found no errors (plus any output you give it) and returns 1 as well as an error message when it encounters errors.
Editors and scripts do not behave like the interactive terminal, when you run a function it does not automatically show the the result. You need to actually tell it to do it yourself.
Generally you just print the results.
If you use print(data.shape) it should return what you expect with the success message Process finished with exit code 0.
exit code 0 means you code run with no error.
Let's give a error code for example(clearly in the below image): in below code, the variable lst is an empty list,
but we get the 5 member in it(which not exists), so the program throws IndexError, and exit 1 which means there is error with the code.
You can also define exit code for analysis, for example:
ERROR_USERNAME, ERROR_PASSWORD, RIGHT_CODE = 683, 11, 0
right_name, right_password = 'xy', 'xy'
name, password = 'xy', 'wrong_password'
if name != right_name:
exit(ERROR_USERNAME)
if password != right_password:
exit(ERROR_PASSWORD)
exit(RIGHT_CODE)
I would recommend you to read up onexit codes.
exit 0 means no error.
exit 1 means there is some error in your code.
This is not pyCharm or python specific. This is a very common practice in most of the programming languages. Where exit 0 means the successful execution of the program and a non zero exit code indicates an error.
Almost all the program(C++/python/java..) return 0 if it runs successful.That isn't specific to pycharm or python.
In program there is no need to invoke exit function explicitly when it runs success it invoke exit(0) by default, invoke exit(not_zero_num) when runs failed.
You can also invoke exit function with different code(num) for analysis.
You can also see https://en.wikipedia.org/wiki/Exit_(system_call) for more details.
What worked for me when this happened was to go to
Run --> Edit Configurations --> Execution --> check the box Run with
Python Console (which was unchecked).
This means that the compilation was successful (no errors). PyCharm and command prompt (Windows OS), terminal (Ubuntu) don't work the same way. PyCharm is an editor and if you want to print something, you explicitly have to write the print statement:
print(whatever_you_want_to_print)
In your case,
print(data.shape)
I think there's no problem in your code and you could find your print results (and other outputs) in the tab 5: Debug rather than 4: Run.
I just ran into this, but couldn't even run a simple print('hello world') function.
Turns out Comodo's Firewall was stopping the script from printing. This is a pretty easy fix by deleting Python out of the Settings > Advanced > Script Analysis portion of Comodo.
Good Luck
I had same problem with yours. And I finally solve it
I see you are trying to run code "Kaggle - BreastCancer.py"
but your pycharm try to run "Breast.py" instead of your code.
(I think Breast.py only contains functions so pycharm can run without showing any result)
Check on tab [Run] which code you are trying to run.
Your starting the program's run from a different file than you have open there. In Run (alt+shift+F10), set the python file you would like to run or debug.

How can I see why a file is listed in "syntax error files" in vivado

Syntax error files:
I want to know where I can see the exact error info.There's no hint in vivado.
Thanks!
You can usually check the message tab at the bottom of the screen. Anyhow Vivado is not particularly good at telling you what's wrong with your code (I'm not sure if this has to do with Vivado or parsing HDL in general), so be aware that your error may be "cascading" from an error above in your code than where the message indicates there's something wrong).
For instance, when making the following mistake in line 13:
13 reg [15:0] test_reg_0
14 reg [15:0] test_reg_1;
it will tell you test_reg_1 is not declared and mark it as an error everywhere it's referenced.

Executing "db2look" in VB Excel - Getting Run-Time error: An unexpected "db2look" was found

I am trying to execute "db2look" command from within Excel using VB. But I'm getting Run-time Error
An unexpected token "db2look" was found following "BEGIN-OF-STATEMENT". Expected tokens include: "DECLARE". SQLSTATE=42601
I know connection and everything is fine, as I am able to run simple select queries and based on error it's not connection issue but rather like "db2look" not recognized or valid. I've ran same exact command in cmd window at it works fine.
Just wondering if anyone has been able to run the "db2look" command outside of db2 command window/editor and using VB/Excel? Or if there is something that I am missing.
Thanks
db2look is a tool and standalone executable which cannot be run like a regular SQL statement. It needs to be run from the command line (shell).

ActiveTCL - Unable to run a batch file from an Expect Script

I was originally trying to run an executable (tftpd32.exe) from Expect with the following command, but for some unknown reason it would hanged the entire script:
exec c:/tftpd32.351/tftpd32.exe
So, decided to call a batch file that will start the executable.
I tried to call the batch file with the following command, but get an error message stating windows cannot find the file.
exec c:/tftpd32.351/start_tftp.bat
I also tried the following, but it does not start the executable:
spwan cmd.exe /c c:/tftpd32.351/start_tftp.bat
The batch file contains this and it run ok when I double click on it:
start tftpd32.exe
Any help would be very much appreciated.
Thanks
The right way to run that program from Tcl is to do:
set tftpd "c:/tftpd32.351/tftpd32.exe"
exec {*}[auto_execok start] "" [file nativename $tftpd]
Note that you should always have that extra empty argument when using start (due to the weird way that start works; it has an optional string in quotes that specifies the window title to create, but it tends to misinterpret the first quoted string as that even if that leaves it with no mandatory arguments) and you need to use the native system name of the executable to run, hence the file nativename.
If you've got an older version of Tcl inside your expect program (8.4 or before) you'd do this instead:
set tftpd "c:/tftpd32.351/tftpd32.exe"
eval exec [auto_execok start] [list "" [file nativename $tftpd]]
The list command in that weird eval exec construction adds some necessary quoting that you'd have trouble generating otherwise. Use it exactly as above or you'll get very strange errors. (Or upgrade to something where you don't need nearly as much code gymnastics; the {*} syntax was added for a good reason!)

Getting debug output in SQL Server Management Studio

I'm generating a large script to do a bunch of inserts and updates. When I run it I get some errors, but the error messages don't let me pinpoint the problem - the line numbers are since the last "GO", so I can't find the right line.
I'd like to add calls to my script to a function in T-SQL that will just write to the results window, so I'd have a better idea where the error occurs.
You can simply use PRINT in the pleces that you suspect can cause problems
e.g.
print 'Step 1'
insert into tableA -- some code here
...
print 'Step 2'
etc
You can also wrap your code into block of TRY CATCH statements and throw custom errors or print error messages if something goes wrong
PRINT statements as suggested by #kristof would do what you want.
However you could run SQL Profiler side-by-side when you execute the script, catching all classes in the Errors and Warnings section and all SQL:StmtStarting events -- this would mean you wouldn't have to edit your script.