zeppelin_ipyspark.py at apache zeppelin get SyntaxError: invalid syntax - python

when i running code with pyspark in apache zeppelin 0.8.1 , i get error like
java.lang.NullPointerException
at org.apache.thrift.transport.TSocket.open(TSocket.java:170)
at org.apache.zeppelin.interpreter.remote.ClientFactory.create(ClientFactory.java:51)
...
so i open all file in my folder zeppelin
and i try to running file zeppelin_ipyspark.py at D:\zeppelin-0.8.1-bin-all\interpreter\spark\python with cmd
and i get error
D:\zeppelin-0.8.1-bin-all\interpreter\spark\python>zeppelin_ipyspark.py
File "D:\zeppelin-0.8.1-bin-all\interpreter\spark\python\zeppelin_ipyspark.py", line 29
port=${JVM_GATEWAY_PORT}, auth_token=gateway_secret, auto_convert=True))
^
SyntaxError: invalid syntax
so can you help me?

#LSS zeppelin_ipyspark.py is not a standalone script.
It is invoked internally from Zeppelin's java code as part of Ipython interpreter, where the python script is processed to replace these strings(like JVM_GATEWAY_PORT etc) with actual values.
You can check the code references: 1, 2

Related

Pyinstaller - invalid syntax

I am trying to use pyinstaller to package my script into an exe.
All sources indicate that the correct syntax is: pyinstaller FullClientCreator.py
When I issue this command, I get a syntax error:
pyinstaller FullClientCreator.py
File "C:\Users\DAVIDM~1\AppData\Local\Temp/ipykernel_7368/3509825318.py", line 1
pyinstaller FullClientCreator.py
^
SyntaxError: invalid syntax
I also tried it with the full path for the file, and I still get the same error:
pyinstaller "D:\Projects\ZZNew Client CreatorZZ\FullClientCreator.py"
File "C:\Users\DAVIDM~1\AppData\Local\Temp/ipykernel_7368/546891165.py", line 1
pyinstaller "D:\Projects\ZZNew Client CreatorZZ\FullClientCreator.py"
^
SyntaxError: invalid syntax
I am at a complete loss as to why this could be, so if anyone has any suggestions, I would greatly appreciate them.
Try another shell
I dont know which shell are you using but if you're using python shell sometimes its not working for python shell so try it on your cmd
pyinstaller --onefile file.py

syntax error in every python scripts SyntaxError: invalid syntax

File "account_creator.py", line 63
username = f"{first_name}_{last_name}{random.randint(1000, 9999)}"
^
SyntaxError: invalid syntax
every script i run gives this error
You need to use a newer version of Python. Install a version of python 3.6 or newer, then your problem should be solved!

"No module named". Python error in gdb

I'm working on a class project (don't worry, this question is not homework) and recently moved from department machines to my own machine.
The project is to build a simple operating system. To make the task easier, we are provided with the ability to "attach" gdb to QEMU in which our program runs. Running this program without attaching gdb on my computer works fine, however it is when I start trying to use gdb that it does not run.
The main thing to note (I think) is that it runs fine on the department computers (gdb 7.4.1-debian) but not on mine (7.6.1-ubuntu).
The error I am getting pertaining to python is that gdb extensions are written in python but they do not seem to be found. I am also getting syntax error. A run of the program looks like this:
/usr/bin/qemu-system-i386
GNU gdb (GDB) 7.6.1-ubuntu
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/alfonso/course/cs167/weenix/kernel/weenix.dbg...done.
After which it hangs for a bit, then gives me this error:
inittmp.gdb:1: Error in sourced command file:
localhost:1234: Connection timed out.
Traceback (most recent call last):
File "/home/alfonso/course/cs167/weenix/kernel/mm/memcheck.py", line 5, in <module>
import weenix
ImportError: No module named 'weenix'
File "/home/alfonso/course/cs167/weenix/kernel/mm/page.py", line 15
print "pagesize: {0}".format(weenix.kmem.pagesize())
^
SyntaxError: invalid syntax
File "/home/alfonso/course/cs167/weenix/kernel/mm/slab.py", line 40
print "{1:<{0}} {3:>{2}} {5:>{4}} {7:>{6}}".format(
^
SyntaxError: invalid syntax
File "/home/alfonso/course/cs167/weenix/kernel/proc/proc.py", line 17
print weenix.proc.str_proc_tree()
^
SyntaxError: invalid syntax
Traceback (most recent call last):
File "/home/alfonso/course/cs167/weenix/kernel/util/debug.py", line 3, in <module>
import weenix
ImportError: No module named 'weenix'
Traceback (most recent call last):
File "/home/alfonso/course/cs167/weenix/kernel/util/list.py", line 3, in <module>
import weenix
ImportError: No module named 'weenix'
Breakpoint 1 at 0xc0008f04: file util/debug.c, line 190.
Breakpoint 2 at 0xc0007016: file main/kmain.c, line 298.
Breakpoint 3 at 0xc0006cf3: file main/kmain.c, line 129.
init.gdb:6: Error in sourced command file:
The program is not being run.
Of course, the import errors and invalid syntaxes made me initially think about my PYTHONPATH and/or package settings, but that is something that works fine (tested it). The only thing I can think of is that I have some configuration problems that I am overlooking.
If you would like me to, I can post the bash script, .gdb files and the rest, but since this works fine on department computers, I doubt this is the problem.
Python versions: (department: "2.7.3", me: "2.7.5+")
EDIT:
After some searching, I have realized that the newest Linux Mint(petra) uses gdb that interprets python as python3. I am currently looking for a way to configure gdb, but as I have never done it before, I would appreciate if someone could direct me in doing so.
You use Python 3 for this debug mode.
$ python3 test33.py
File "test33.py", line 1
print "hello".format()
^
SyntaxError: invalid syntax
Make sure you use Python 2 as you say.
I'm doing this homework, too. (I guess weenix is too commonly used for OS courses.)
Regarding "import weenix" problem, it's because weenix's python script isn't in gdb's data directory. When using gdb with python, this dir will be added to python's PATH automatically. Therefore, just put "weenix/python/weenix" under your data directory/python. As for me, it's /usr/shared/gdb/.
Having fun with weenix!

emacs python jedi error

I am trying to setup my GNU Emacs 24.3.1 for python development following the instructions here:
https://www.youtube.com/watch?v=0cZ7szFuz18
The installation gave a few warnings but was successful. Then I open a new buffer with file 01.py and try to use the auto-complete:
import os
os.
But get this error:
deferred error : (error Server may raise an error : File "/home/avilella/.emacs.d/elpa/jedi-0.1.2/jediepcserver.py", line 71
return _WHITESPACES_RE.sub(' ', desc) if desc and desc != 'None' else ''
^
SyntaxError: invalid syntax
)
Any ideas what is going on?
emacs is using an old version of python. The code that gets the error is python 2.6+ syntax I believe.

install error or error running python file

I am running a basic Python file on Windows XP from IDLE.
The file name is assignment1.py.
The file content is:
import sys
var = 5
but when I run it, it gives the error:
Command: python assignment1.py
SyntaxError: invalid syntax
Then I tried another thing which also gave an error:
Command: which python
SyntaxError: invalid syntax
Not sure if the installation is wrong or something.
I am able to run the print command successfully:
>>> print "I am working fine"
I am working fine
Not sure of the issue. Request help.
It looks like what you are entering as the "command" is being interpreted as Python code. I mean, python assignment1.py is interpreted as Python code. The result is as expected:
$ python -c 'python assignment1.py'
File "<string>", line 1
python assignment1.py
^
SyntaxError: invalid syntax
You need to run the file in the correct way, probably via the IDLE menu or by pressing F5. You can check these questions for details:
How do I run a Python program?
Running Python script from IDLE on Windows 7 64 bit

Categories

Resources