Questions tagged [pythoninterpreter]

The PythonInterpreter class is a standard wrapper for a Jython interpreter for embedding in a Java application.

The PythonInterpreter class is a standard wrapper for a Jython interpreter for embedding in a Java application. Javadoc can be found [here].(http://www.jython.org/javadoc/org/python/util/PythonInterpreter.html)

127 questions
0
votes
1 answer

How to embed Python within C++ and call each other with PyBind11

I want to embed a Python interpreter within my C++ application, and make them call each other. I followed the sample in the official doc of pybind11, and now I can call a python sub-program and create a object of python's class in the main program…
Leon
  • 1,489
  • 1
  • 12
  • 31
0
votes
2 answers

Return does not output any value, however, print does. Python interpreter problem?

def x1(): y = input("Input pet here: ") if y == "pet": return True else: return False x1() def x2(): y = input("Input pet here: ") if y == "pet": print(y) else: print("not a…
Jirafey
  • 57
  • 8
0
votes
1 answer

VSCode VEnv Import Module

I am having trouble figuring out venv and getting my Python script to import libraries in Vscode. I set up a virtual environment and imported libraries necessary (matplotlib). I've activate the scripts in venv using .venv\activate, and set my…
0
votes
1 answer

ModuleNotFoundError: No module named '' - Installation error

I am building a desktop app using Python and PySimpleGUI. So far, everything works just fine. Whilst I was working at the project, I realized I need to find a way to get the duration of some mp3 files and to display it in a certain way. I…
geekt
  • 1,979
  • 3
  • 10
  • 20
0
votes
1 answer

Using for loops in python interpreter

I'm trying to start a for loop after doing something else in python interpreter on the same line, and it throws a SyntaxError when I do so. >>> a,b = 0, 1;\ ... for i in range(1, 10): File "", line 2 for i in range(1, 10): …
syzygy350
  • 23
  • 5
0
votes
0 answers

How does python handle different python versions for code & imported custom libraries

Say, An app is using python3, but it leverages/installs a custom library (which uses python2.7), will the respective python versions be maintained when their methods are executed? Ex - a method in the app(using python3) calls the method…
Vaibhav Rai
  • 183
  • 1
  • 8
0
votes
0 answers

Why does my tflite model predict well with Python interpreter, but very poorly when deployed in Android Studio?

I have built a model using mobilenet for a specific training data set. When testing my model with a test set, the model generated in keras (model.h5) obtains an accuracy of approximately 92%. Then I converted my model to tflite with the following…
0
votes
0 answers

How to launch existing packages after upgrading python3

I use macOs Sierra version 10.12.6 on my MacBook Air, and python 3.7 and pipenv, Today I ran brew upgrade and updated Xcode Command Line Tools from App store. After that I found out that the python is upgraded to 3.8 version. My problem is that when…
m kiani
  • 137
  • 8
0
votes
3 answers

How to make a python objects self or attribute not get assigned to the referencer object when it is references?

I want when a object is referenced by another, the refernecer's self object or one of it's attributes to be different at the referencer object This is what I want to do: class MyClass: . . . . a = MyClass() b = a print(b is a) #must…
0
votes
0 answers

why is there only a referenced before assignment error for int values but not lists inside a nested function?

I'm doing a leetcode problem - rightSideView. When I create an inner helper function, I thought I'd have access to the outer function variables. However, that only holds true for result (a list) but not maxHeight (an int). Code referenced…
0
votes
2 answers

Python ('base':conda) vs the one in opt/local/bin, what are the differences?

I am using Visual Studio Code, and trying to set my python interpreter, then i come across this. The one in "opt/local/bin/python x.x", and the one in "/opt/miniconda3/bin/python" , How are they different? Thank you in advance. Are they basically…
yts61
  • 1,142
  • 2
  • 20
  • 33
0
votes
1 answer

Question about the 'non-linear' behaviour of the Python interpreter in Jupyter

I'm running the following code both remotely on a linux machine via ssh, and on the same linux machine as a Jupyter notebook accessed through a browser. import cv2 import pdf2image def minimalFun(pdf_filepath, make_me_suffer = False): …
0
votes
3 answers

vscode do not find my custom python package

I'm new to VS Code for python development on Windows and my pylint cannot find a package. This is my project directory structure. workspace/ <- This is VS Code workspace (E:\workspace) .vscode/ launch.json settings.json project1/ …
N Lee
  • 21
  • 1
  • 6
0
votes
0 answers

VS Code doesn't switch between Anaconda environments correctly

I have: two conda environments, myenv1 and myenv2; two folders containing .py files: folder1 and folder2. Let's say I've been working on folder1 in VS Code using myenv1, and then I do the following: I close folder1 (using File -> Close Folder) I…
Frank
  • 223
  • 3
  • 11
0
votes
1 answer

python calling C/C++ calling python

I have a python3 application calling C/C++ functions. In one of the C++ functions, I'd like to run a python interpreter. It doesn't have to deal with the first python environment, the are totaly dissociated. I tied to use embed a pybind interpreter…
Fred
  • 39
  • 4
1 2 3
8 9