PyDev 5.7.0.20170411357 No Longer Supports IronPython - pydev

I recently upgraded my PyDev plugin to version 5.7.0.20170411357.
It seems IronPython is no longer supported.
I'm using Eclipse Oxygen
Does anyone have a workaround?
When starting the debugger the following message is displayed:
RuntimeError: Unable to proceed (sys._current_frames not available in this Python implementation).
Yes, I am adding the Vm argument -x:Frames.
The error is thrown from pydevd_additional_thread_info_regular.py
There is an accommodation for Jython.
if not hasattr(sys, '_current_frames'):
# Some versions of Jython don't have it (but we can provide a replacement)
if IS_JYTHON:
from java.lang import NoSuchFieldException
from org.python.core import ThreadStateMapping
try:
cachedThreadState = ThreadStateMapping.getDeclaredField('globalThreadStates') # Dev version
except NoSuchFieldException:
cachedThreadState = ThreadStateMapping.getDeclaredField('cachedThreadState') # Release Jython 2.7.0
cachedThreadState.accessible = True
thread_states = cachedThreadState.get(ThreadStateMapping)
def _current_frames():
as_array = thread_states.entrySet().toArray()
ret = {}
for thread_to_state in as_array:
thread = thread_to_state.getKey()
if thread is None:
continue
thread_state = thread_to_state.getValue()
if thread_state is None:
continue
frame = thread_state.frame
if frame is None:
continue
ret[thread.getId()] = frame
return ret
else:
raise RuntimeError('Unable to proceed (sys._current_frames not available in this Python implementation).')
else:
_current_frames = sys._current_frames

Related

Using poetry on different machines

I am working on a Python project and recently started using poetry. I was originally working on the project using macOS 11.0, but as I near completion, I wanted to test it on a Linux workstation. I use Github for my repository, and so, I am able to clone the repo easily. However, that is where the simple part ends. I have used both pyenv and conda for the virtual environment on macOS, but when I clone the repo onto the workstation, I set up an environment and then try the following command:
poetry shell
poetry install
I receive the following error after poetry install:
ParseVersionError
Unable to parse "at20RC5+54.g5702a232fe.dirty".
at ~/.poetry/lib/poetry/_vendor/py3.8/poetry/core/semver/version.py:211 in parse
207│ except TypeError:
208│ match = None
209│
210│ if match is None:
→ 211│ raise ParseVersionError('Unable to parse "{}".'.format(text))
212│
213│ text = text.rstrip(".")
214│
215│ major = int(match.group(1))
I have tried poetry lock with the same result, and I have even deleted poetry.lock and attempted poetry lock with no success.
I intend to build and publish it when all is said and done, but because I eventually want to add features that my Mac does not have (e.g., CUDA), I want to code on the workstation as well.
Any help will be appreciated.
Update -- 03/27/21
pyproject.toml
[tool.poetry]
name = "qaa"
version = "0.1.0"
description = "Quasi-Anharmonic Analysis"
authors = ["Timothy H. Click <tclick#okstate.edu>"]
license = "BSD-3-Clause"
readme = "README.rst"
homepage = "https://github.com/tclick/qaa"
repository = "https://github.com/tclick/qaa"
documentation = "https://qaa.readthedocs.io"
classifiers = [
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
]
[tool.poetry.urls]
Changelog = "https://github.com/tclick/qaa/releases"
[tool.poetry.dependencies]
python = "^3.8"
click = "^7.0"
numpy = "^1.20.1"
scipy = "^1.6.1"
matplotlib = "^3.3.4"
seaborn = "^0.11.1"
scikit-learn = "^0.24.1"
pandas = "^1.2.3"
netCDF4 = "^1.5.6"
mdtraj = "^1.9.5"
[tool.poetry.dev-dependencies]
pytest = "^6.2.2"
pytest-cache = "^1.0"
pytest-click = "^1.0.2"
pytest-console-scripts = "^1.1.0"
pytest-cov = "^2.11.1"
pytest-flake8 = "^1.0.7"
pytest-mock = "^3.5.1"
pytest-pep8 = "^1.0.6"
pytest-randomly = "^3.5.0"
coverage = {extras = ["toml"], version = "^5.3"}
safety = "^1.9.0"
mypy = "^0.812"
typeguard = "^2.9.1"
xdoctest = {extras = ["colors"], version = "^0.15.0"}
sphinx = "^3.3.1"
sphinx-autobuild = "^2020.9.1"
pre-commit = "^2.8.2"
flake8 = "^3.8.4"
black = "^20.8b1"
flake8-bandit = "^2.1.2"
flake8-bugbear = "^21.3.2"
flake8-docstrings = "^1.5.0"
flake8-rst-docstrings = "^0.0.14"
pep8-naming = "^0.11.1"
darglint = "^1.5.5"
reorder-python-imports = "^2.3.6"
pre-commit-hooks = "^3.3.0"
sphinx-rtd-theme = "^0.5.0"
sphinx-click = "^2.5.0"
Pygments = "^2.7.2"
ipython = "^7.21.0"
isort = "^5.7.0"
towncrier = "^19.2.0"
nox = "^2020.12.31"
pytest-coverage = "^0.0"
nox-poetry = "^0.8.4"
numpydoc = "^1.1.0"
codecov = "^2.1.11"
flake8-black = "^0.2.1"
flake8-import-order = "^0.18.1"
[tool.poetry.scripts]
qaa = "qaa.__main__:main"
update -- 03/29/21
This is the error received when running poetry lock -vvv
Using virtualenv: /home/tclick/.cache/pypoetry/virtualenvs/qaa-VNW0yB_S-py3.8
Stack trace:
10 ~/.poetry/lib/poetry/_vendor/py3.8/clikit/console_application.py:131 in run
129│ parsed_args = resolved_command.args
130│
→ 131│ status_code = command.handle(parsed_args, io)
132│ except KeyboardInterrupt:
133│ status_code = 1
9 ~/.poetry/lib/poetry/_vendor/py3.8/clikit/api/command/command.py:120 in handle
118│ def handle(self, args, io): # type: (Args, IO) -> int
119│ try:
→ 120│ status_code = self._do_handle(args, io)
121│ except KeyboardInterrupt:
122│ if io.is_debug():
8 ~/.poetry/lib/poetry/_vendor/py3.8/clikit/api/command/command.py:163 in _do_handle
161│ if self._dispatcher and self._dispatcher.has_listeners(PRE_HANDLE):
162│ event = PreHandleEvent(args, io, self)
→ 163│ self._dispatcher.dispatch(PRE_HANDLE, event)
164│
165│ if event.is_handled():
7 ~/.poetry/lib/poetry/_vendor/py3.8/clikit/api/event/event_dispatcher.py:22 in dispatch
20│
21│ if listeners:
→ 22│ self._do_dispatch(listeners, event_name, event)
23│
24│ return event
6 ~/.poetry/lib/poetry/_vendor/py3.8/clikit/api/event/event_dispatcher.py:89 in _do_dispatch
87│ break
88│
→ 89│ listener(event, event_name, self)
90│
91│ def _sort_listeners(self, event_name): # type: (str) -> None
5 ~/.poetry/lib/poetry/console/config/application_config.py:141 in set_installer
139│
140│ poetry = command.poetry
→ 141│ installer = Installer(
142│ event.io,
143│ command.env,
4 ~/.poetry/lib/poetry/installation/installer.py:65 in __init__
63│ self._installer = self._get_installer()
64│ if installed is None:
→ 65│ installed = self._get_installed()
66│
67│ self._installed_repository = installed
3 ~/.poetry/lib/poetry/installation/installer.py:561 in _get_installed
559│
560│ def _get_installed(self): # type: () -> InstalledRepository
→ 561│ return InstalledRepository.load(self._env)
562│
2 ~/.poetry/lib/poetry/repositories/installed_repository.py:118 in load
116│ path = Path(str(distribution._path))
117│ version = distribution.metadata["version"]
→ 118│ package = Package(name, version, version)
119│ package.description = distribution.metadata.get("summary", "")
120│
1 ~/.poetry/lib/poetry/_vendor/py3.8/poetry/core/packages/package.py:61 in __init__
59│
60│ if not isinstance(version, Version):
→ 61│ self._version = Version.parse(version)
62│ self._pretty_version = pretty_version or version
63│ else:
ParseVersionError
Unable to parse "at20RC5+54.g5702a232fe.dirty".
at ~/.poetry/lib/poetry/_vendor/py3.8/poetry/core/semver/version.py:206 in parse
202│ except TypeError:
203│ match = None
204│
205│ if match is None:
→ 206│ raise ParseVersionError('Unable to parse "{}".'.format(text))
207│
208│ text = text.rstrip(".")
209│
210│ major = int(match.group(1))
I think you should NOT run poetry shell first. It's used only when poetry project and its dependencies are installed.
poetry install should work nice in the project directory with pyproject.toml
Possible help:
ensure that poetry installed and path to poetry executable in PATH
environment variable;
check that python 3.8+ is installed (from your dependencies). If
you use pyenv check that path to this version is available for
terminal.

environment variables using subprocess.check_output Python

I'm trying to do some basic module setups on my server using Python. Its a bit difficult as I have no access to the internet.
This is my code
import sys
import os
from subprocess import CalledProcessError, STDOUT, check_output
def run_in_path(command, dir_path, env_var=''):
env_var = os.environ["PATH"] = os.environ["PATH"] + env_var
print(env_var)
try:
p = check_output(command, cwd=dir_path, stderr=STDOUT)
except CalledProcessError as e:
sys.stderr.write(e.output.decode("utf-8"))
sys.stderr.flush()
return e.returncode
else:
return 0
def main():
requests_install = run_in_path('python setup.py build',
'D:\installed_software\python modules\kennethreitz-requests-e95e173')
SQL_install = run_in_path('python setup.py install', # install SQL module pypyodbc
'D:\installed_software\python modules\pypyodbc-1.3.3\pypyodbc-1.3.3')
setup_tools = run_in_path('python setup.py install', # install setup tools
'D:\installed_software\python modules\setuptools-17.1.1')
psycopg2 = run_in_path('easy_install psycopg2-2.6.1.win-amd64-py3.3-pg9.4.4-release', # install setup tools
'D:\installed_software\python modules', ';C:\srv_apps\Python33\Scripts\easy_install.exe')
print('setup complete')
if __name__ == "__main__":
sys.exit(main())
now it gets tricky when i start trying to use easy install. It appears my env variables are not being used by my subprocess.check_output call
File "C:\srv_apps\Python33\lib\subprocess.py", line 1110, in _execute_child
raise WindowsError(*e.args)
FileNotFoundError: [WinError 2] The system cannot find the file specified
I don't want to have to upgrade to 3.4 where easy install is installed by default because my other modules are not supported on 3.4. My main challenge is the subprocess.check_call method does not take environment variables as an input and im wary of trying to use Popen() as I have never really got it to work successfully in the past. Any help would be greatly appreciated.
PATH should contain directories e.g., r'C:\Python33\Scripts', not files such as: r'C:\Python33\Scripts\easy_install.exe'
Don't hardcode utf-8 for an arbitrary command, you could enable text mode using universal_newlines parameter (not tested):
#!/usr/bin/env python3
import locale
import sys
from subprocess import CalledProcessError, STDOUT, check_output
def run(command, *, cwd=None, env=None):
try:
ignored = check_output(command, cwd=cwd, env=env,
stderr=STDOUT,
universal_newlines=True)
except CalledProcessError as e:
sys.stderr.write(e.output)
sys.stderr.flush()
return e.returncode
else:
return 0
Example:
import os
path_var = os.pathsep.join(os.environ.get('PATH', os.defpath), some_dir)
env = dict(os.environ, PATH=path_var)
run("some_command", cwd=some_path, env=env)
run("another_command", cwd=another_path, env=env)

compiles .py to .exe inluding it Classes

I have 4 .py files. Below is a list of files what is required to run the programme. Any of them missing will fail the programme to run.
How my code works:
) GUIss.py imports demonstrator.py
) Demonstrator.py imports filereader.py and process.py
) To run the programm I just need to click GUIss.py.
My cx-freeze code below:
from cx_Freeze import setup,Executable
import os
includefiles = ['filereader.py','demonstrator.py','logo.gif','thebrighterchoice.gif']
#bin_includes= ['process.py','demonstrator.py','filereader.py'] ..... 'bin_includes':bin_includesincludes = ['process']
includes = ['process','tkinter']
excludes = ['tkinter']
packages = ['os','xlrd']
setup(
name = "Process",
version = "0.1",
description = "description",
author = "Raitis Kupce",
options = {'build_exe' :{'excludes': excludes,'includes':includes,'packages':packages,'include_files':includefiles}},
executables = [Executable("GUIss.py")]
)
When I run compiled file I get an error message:
I then tried to write in setup.py (cx-freeze file)
excludes = ['tkinter']
Then includes = ['tkinter']
Afterwards packages = ['tkinter']
Despite numerous attempt, no luck, same message all the time.
P.S
My python source code can be downloaded from https://github.com/Dragnets/Administration
I did studied hours from here and here and modifying endless times but no luck.

Neo4j embedded online backup from Java

I am using Neo4j(embedded) Enterprise edition 1.9.4 along with Scala-Neo4j wrapper in my project. I tried to backup the Neo4j data using Java like below
def backup_data()
{
val backupPath: File = new File("D:/neo4j-enterprise-1.9.4/data/backup/")
val backup = OnlineBackup.from( "127.0.0.1" )
if(backupPath.list().length > 0)
{
backup.incremental( backupPath.getPath() )
}
else
{
backup.full( backupPath.getPath() );
}
}
It is working fine for the full backup. But the incremental backup part is throwing the Null pointer exception.
Where did I go wrong?
EDIT
Building the GraphDatabase instance through Scala-Neo4j wrapper
class MyNeo4jClass extends SomethingClass with Neo4jWrapper with EmbeddedGraphDatabaseServiceProvider {
def neo4jStoreDir = "/tmp/temp-neo-test"
. . .
}
Stacktrace
Exception in thread "main" java.lang.NullPointerException
at org.neo4j.consistency.checking.OwnerChain$3.checkReference(OwnerChain.java:111)
at org.neo4j.consistency.checking.OwnerChain$3.checkReference(OwnerChain.java:106)
at org.neo4j.consistency.report.ConsistencyReporter$DiffReportHandler.checkReference(ConsistencyReporter.java:330)
at org.neo4j.consistency.report.ConsistencyReporter.dispatchReference(ConsistencyReporter.java:109)
at org.neo4j.consistency.report.PendingReferenceCheck.checkReference(PendingReferenceCheck.java:50)
at org.neo4j.consistency.store.DirectRecordReference.dispatch(DirectRecordReference.java:39)
at org.neo4j.consistency.report.ConsistencyReporter$ReportInvocationHandler.forReference(ConsistencyReporter.java:236)
at org.neo4j.consistency.report.ConsistencyReporter$ReportInvocationHandler.dispatchForReference(ConsistencyReporter.java:228)
at org.neo4j.consistency.report.ConsistencyReporter$ReportInvocationHandler.invoke(ConsistencyReporter.java:192)
at $Proxy17.forReference(Unknown Source)
at org.neo4j.consistency.checking.OwnerChain.check(OwnerChain.java:143)
at org.neo4j.consistency.checking.PropertyRecordCheck.checkChange(PropertyRecordCheck.java:57)
at org.neo4j.consistency.checking.PropertyRecordCheck.checkChange(PropertyRecordCheck.java:35)
at org.neo4j.consistency.report.ConsistencyReporter.dispatchChange(ConsistencyReporter.java:101)
at org.neo4j.consistency.report.ConsistencyReporter.forPropertyChange(ConsistencyReporter.java:382)
at org.neo4j.consistency.checking.incremental.StoreProcessor.checkProperty(StoreProcessor.java:61)
at org.neo4j.consistency.checking.AbstractStoreProcessor.processProperty(AbstractStoreProcessor.java:95)
at org.neo4j.consistency.store.DiffRecordStore$DispatchProcessor.processProperty(DiffRecordStore.java:207)
at org.neo4j.kernel.impl.nioneo.store.PropertyStore.accept(PropertyStore.java:83)
at org.neo4j.kernel.impl.nioneo.store.PropertyStore.accept(PropertyStore.java:43)
at org.neo4j.consistency.store.DiffRecordStore.accept(DiffRecordStore.java:159)
at org.neo4j.kernel.impl.nioneo.store.RecordStore$Processor.applyById(RecordStore.java:180)
at org.neo4j.consistency.store.DiffStore.apply(DiffStore.java:73)
at org.neo4j.kernel.impl.nioneo.store.StoreAccess.applyToAll(StoreAccess.java:174)
at org.neo4j.consistency.checking.incremental.IncrementalDiffCheck.execute(IncrementalDiffCheck.java:43)
at org.neo4j.consistency.checking.incremental.DiffCheck.check(DiffCheck.java:39)
at org.neo4j.consistency.checking.incremental.intercept.CheckingTransactionInterceptor.complete(CheckingTransactionInterceptor.java:160)
at org.neo4j.kernel.impl.transaction.xaframework.InterceptingXaLogicalLog$1.intercept(InterceptingXaLogicalLog.java:79)
at org.neo4j.kernel.impl.transaction.xaframework.XaLogicalLog$LogDeserializer.readAndWriteAndApplyEntry(XaLogicalLog.java:1120)
at org.neo4j.kernel.impl.transaction.xaframework.XaLogicalLog.applyTransaction(XaLogicalLog.java:1292)
at org.neo4j.kernel.impl.transaction.xaframework.XaResourceManager.applyCommittedTransaction(XaResourceManager.java:766)
at org.neo4j.kernel.impl.transaction.xaframework.XaDataSource.applyCommittedTransaction(XaDataSource.java:246)
at org.neo4j.com.ServerUtil.applyReceivedTransactions(ServerUtil.java:423)
at org.neo4j.backup.BackupService.unpackResponse(BackupService.java:453)
at org.neo4j.backup.BackupService.incrementalWithContext(BackupService.java:388)
at org.neo4j.backup.BackupService.doIncrementalBackup(BackupService.java:286)
at org.neo4j.backup.BackupService.doIncrementalBackup(BackupService.java:273)
at org.neo4j.backup.OnlineBackup.incremental(OnlineBackup.java:147)
at Saddahaq.User_node$.backup_data(User_node.scala:1637)
at Saddahaq.User_node$.main(User_node.scala:2461)
at Saddahaq.User_node.main(User_node.scala)
After the backup is taken, the backed target is checked for consistency. The incremental version of the consistency checker currently suffers from a bug leading to the observed NPE.
Workaround: either always take full backups with backup.full or prevent consistency checking on incremental backups by using
backup.incremental(backupPath.getPath(), false);

Selenium find_element_by_id returns None

I am using selenium and i have properly installed the selenium module on redhat linux 6.
Below is my script:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
import unittest, time, re
import zlib
class Sele1(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Firefox()
self.driver.implicitly_wait(30)
self.base_url = "https://bugzilla.example.com/"
self.verificationErrors = []
def test_sele1(self):
driver = self.driver
driver.get(self.base_url + "/")
driver.find_element_by_id("Bugzilla_login").clear()
driver.find_element_by_id("Bugzilla_login").send_keys("username")
driver.find_element_by_id("Bugzilla_password").clear()
driver.find_element_by_id("Bugzilla_password").send_keys("password")
driver.find_element_by_id("log_in").click()
driver.find_element_by_id("quicksearch").clear()
driver.find_element_by_id("quicksearch").send_keys("new bugs is bugzilla tool")
driver.find_element_by_xpath("//input[#value='Find Bugs']").click()
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
def tearDown(self):
self.driver.quit()
self.assertEqual([], self.verificationErrors)
if __name__ == "__main__":
unittest.main()
When i am running this script it is showing errors:
ERROR: test_sele1 (main.Sele1)
Traceback (most recent call last):
File "sele1.py", line 19, in test_sele1
driver.find_element_by_id("Bugzilla_login").clear()
AttributeError: 'NoneType' object has no attribute 'clear'
Ran 1 test in 2.018s
FAILED (errors=1)
Plateform: Redhat
Python Version: 2.6
Note: while running the same script in windows7, it is running fine but not running in linux with python2.6
Please help me for this...
Thanks in advance!
Simple: Selenium can't find an element called "Bugzilla_login".
There could be hundreds of reasons this may be happening. I'd start with checking whether you're loading the correct page.