Errno 22 invalid mode('U') or filename - filenames

I'm facing error
[Errno 22] invalid mode('U') or filename:' ' while creating exe file
using cx_
Freeze in Python. my code includes some vbs file which are actually require to interact with Windows features. Those .vbs files are located in same location.
I'm new to this Python. Maybe some silly mistake
Please any help will be really appreciable.
Below is the part of the code. All imports are taken care already.
if s1 == "xx" or s1 == "yy":
os.system("response.vbs")
else:
os.system("no.vbs")
Sorry cannot post the overall code.

Well Problem get solved.
This was first time I was using cx_freez. If we don't mention the fields under setup this error occurs.
setup( name = "THIS CANNOT BE BLANK", version = "0.1", description = "trigger", executables = [Executable("THIS CANNOT BE BLANK")], )
Thank you Tinfoilboy for your responses.
Silly me :(

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.

CPLEX Python API installment on Mac big sur(M1) CpoException problem

I just install Cplex on my mac(m1). When I run any example code, it shows this error.
File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site- packages/docplex/cp/solver/solver_local.py", line 120, in init
raise CpoException("Executable file '{}' does not exists".format(xfile))
CpoException: Executable file 'cpoptimizer' does not exists.
What's the main issue here?
Issue Solved:
Just change this line
msol = mdl.solve(TimeLimit=10) to
msol = mdl.solve(TimeLimit=10, execfile='/Applications/CPLEX_Studio221/cpoptimizer/bin/x86-64_osx/cpoptimizer')

Databricks - FileNotFoundException

I'm sorry if this is basic and I missed something simple. I'm trying to run the code below to iterate through files in a folder and merge all files that start with a specific string, into a dataframe. All files sit in a lake.
file_list=[]
path = "/dbfs/rawdata/2019/01/01/parent/"
files = dbutils.fs.ls(path)
for file in files:
if(file.name.startswith("CW")):
file_list.append(file.name)
df = spark.read.load(path=file_list)
# check point
print("Shape: ", df.count(),"," , len(df.columns))
db.printSchema()
This looks fine to me, but apparently something is wrong here. I'm getting an error on this line:
files = dbutils.fs.ls(path)
Error message reads:
java.io.FileNotFoundException: File/6199764716474501/dbfs/rawdata/2019/01/01/parent does not exist.
The path, the files, and everything else definitely exist. I tried with and without the 'dbfs' part. Could it be a permission issue? Something else? I Googled for a solution. Still can't get traction with this.
Make sure you have a folder named "dbfs" if your parent folder starts from "rawdata" the path should be "/rawdata/2019/01/01/parent" or "rawdata/2019/01/01/parent".
The error is thrown in case of incorrect path.
This is an old thread, but if someone is still looking for a solution:
It does require path to be listed as:
"dbfs:/rawdata/2019/01/01/parent/"

Can't find libgfortran-3.dll in Fortran

I am new to mingw32-gfortran, and I am finding it hard to statically link the specific dll's. I am trying to write a code on finding large factorials,the code compiles without any errors on code::blocks but gives an error about missing dll's when opened from cmd. Is there anyway to statically link these dll's to my exe (I don't mind if it is bloated,I just want my code to be portable).
Does gfortran provide similar libraries for static linking? I have also posted my code for any reference. It would really mean much to me if someone here helped me out, I have already tried code blocks forums,and read numerous posts on other websites. Still no luck.
Note : I use Win 7 64-bit
! A fortran95 program for G95
! By WQY
program main
implicit none
integer ,allocatable,dimension (:) :: a
integer :: re_i,n,digit=1,temp=0,zero=0,i,j,beg,rate,ends
allocate(a(10000000))
a(1)=1
print*,'please enter the number'
read *, n
call system_clock(beg,rate)
do j=2,n
do i=zero+1,digit
temp=temp+a(i)*j
a(i)=temp-(temp/10)*10
temp=temp/10
end do
do while (temp>0)
digit=digit+1
a(digit) = temp-(temp/10)*10
temp = (temp/10)
end do
do while(a(zero+1)==0)
zero=zero+1
end do
end do
call system_clock(ends,rate)
write(*,1,advance='no') a(digit)
write (*,2,advance ='no') '.'
write (*,1) ( a(i),i=digit-1,digit-50,-1)
1 format(120i1)
print *,' X 10^' ,digit-1
2 format(100a1)
print '("computation time ",f6.3," seconds")',real(ends-beg)/real(rate)
re_i=system("pause")
end
Does anyone know how to compile a program in gfortan from command line? Errors seems to pop up every time I try to do so.

What does "system requires 8-byte headers" means

I saw this www.spec.org/cpu2006/Docs/481.wrf.html where it says that
If your system requires 8-byte headers, please set wrf_data_header_size = 8
Would you please tell me how to know that. Thanks in advance.
More info: I am trying to use spec2006 wrf program, which is 2.1 version of the program. I am not able to run that program, although it compiles with runspec.
Error is
At line 6744 of file module_ra_rrtm.fppized.f90 (unit = 10, file = 'RRTM_DATA')
Fortran runtime error: End of file
*** Miscompare of rsl.out.0000, see /path/rsl.out.0000.mis
'rsl.out.0000' short
Error: 1x481.wrf
I will be very grateful for any help.
You simply need to add wrf_data_header_size = 8 in the SPEC CPU configuration file you're using to build/run the WRF benchmarks.
See the config/Example-linux64-amd64-gcc41.cfg example configuration file that comes with SPEC CPU2006.