• 0

ATOM - editor: how to set the paths - to Python


Question

hello dear  MX-experts

 

this is a question regarding the setup of a development-environment on a MX-Linux Machine, 

 

the questioin is: with the fresh  setup of ATOM - editor: how to set the paths - to Python

 

to begin with the beginning: 

 

i am pretty new to ATOM: first steps to configure to work with Python on MX-Linux

 

just have installed ATOM on the MX-Linux.

the question is: how to set the paths - to Python.
note: i allready have installed Python on my Mx-Machine.

Which packages do you suggest me to use … to run ATOM with Python!?

 

love to hear from you

 

11 answers to this question

Recommended Posts

  • 0

hi there  I am back again 

 

 

well on my MX linux python is allready installed - so this is done by default. 

probably i need to set the paths"? 

 

 

i try to run a python code and then i see if it works 

 

 

- btw. how to get conda - i did not find it in the installer of ATOM!? 

i googled and found the following: 

https://anaconda.org/anaconda/atom
 
 Description
 Atom is a framework for creating memory efficient Python objects with enhanced features such as dynamic initialization, validation, and change notification for object attributes. 

well should i go this way: 


 To install this package with conda run:
 `conda install -c anaconda atom`

found at the above mentioned site,,,  https://anaconda.org/anaconda/atom

 

 

which things do you add to ATOM to run it as a python-coding editor... 

 

love to hear from you

  • 0

dear Pythonists - dear experts here at NeoWin 

  

i am on MX-linux which is great. but there is no vscode (or even Codium) in the repos of MX-Linux. This is a question regarding the setup of a development-environment on a MX-Linux Machine,  unfortunatly there is no VSCode in the repos - so i need some alternatives: 

 

cf: https://forum.mxlinux.org/viewtopic.php?f=55&t=55936&p=565840#p565840

note: this is sad sad sad. We need to change this pretty soon. Do you have some ideas to get things done her.

 

regarding the actual situation:- on my actual machine.- i thought of using ATOM or PyCharme  i have some experience with both of them - but ATOM i used years ago. 

so here some question regarding the setup and the configuration - and adding packages:

 

the question is: with the fresh setup of ATOM - editor: how to set the paths - to Python to begin with the beginning:-which extensions and packages do you suggest for getting started. Can you suggest some of the most important..ones?

 

as mentioned above: i am (again) pretty new to ATOM: first steps to configure to work with Python on MX-Linux

just have installed ATOM on the MX-Linux.

 

additional: - the question is: how to set the paths - to Python.

note: i allready have installed Python on my Mx-Machine: there 3.7xy is installed. 

Which packages do you suggest me to use … to run ATOM with Python!?

 

look forward to hear from you

 

yours Tarifa

 

 

update:  now i encountered something new: Unable to start the Python language server ::  python -m pip install 'python-language-server[all]'

 

the question as of today: Unable to start the Python language server ::  python -m pip install 'python-language-server[all]'

 

added a pyhton code and suddenly i  got back the following waring 

 

    Unable to start the Python language server.

    Make sure to install pyls 0.19 or newer by running:

 

and the following one: 

 

    python -m pip install 'python-language-server[all]'

 

well  - to be frank ;: i am on MX-Linux and there Pyton is installed by default. So whats the fuss?!

 

 

i am not sure what ATOM wants from me now!?

 

can any body help out here

 

  • 0
  On 20/03/2020 at 22:15, tarifa said:

 

    Unable to start the Python language server.

    Make sure to install pyls 0.19 or newer by running:    python -m pip install 'python-language-server[all]'

i am not sure what ATOM wants from me now!?

Expand  

It's literally telling you in the error message the command you need to run!

  • 0
  On 20/03/2020 at 22:32, DaveLegg said:

It's literally telling you in the error message the command you need to run!

Expand  

Hi there good  day dear DaveLegg, many thanks for the quick reply - i have used ATOM years ago - now in these  days (ih have lots of sparetime due to Corona-lockdown here) i have time to work with Atom again.  It is a headstart. 

 

At the moment i am allready running python-scripts. So some of the complaints i just dismiss. - since it works either.. 

regarding the above message : this message shows up while i add a new file to my development folder -/which does not reside in the ATOM-folder - what may be a problem. 

Well in other words i put the files into 

 

martin/dev/ python 

 

while the ATOM-Editor lies is 


 

ATOM 


Davelegg - is this possibly the issue where the complaines are rooted!? The different paths ...

 

Again - if i run the script with packages/script - then all goes well and i can see that all works propperly

 

sorry for being the novice - and for asking dump questions.

 

have a great day

  • 0

ahh hi there DaveLegg just another question - this fits here very well - i guess that i do not need to open a new thread...

 

i have added Script-package -which works fine.

 

all is well now: one question:

 

running Python-Script: with script-pagage: where to see the output - where can i see the output of the script!?

i haver the screens divided and all i see is the following:

 

 

[Finished in 3.141s]

 

 

this is the script:

 

from bs4 import BeautifulSoup
import urllib

url = urllib.urlopen('http://meinparlament.diepresse.com/')
content = url.read()
soup = BeautifulSoup(content, 'lxml')

table = soup.findAll('div',attrs={"class":"content-question"})
for x in table:
    print x.find('p').text

# Another way to retrieve tables:
# table = soup.select('div[class="content-question"]')

 

see my screen ... how all is organized... - the question is:  how can i arrange the whole ATOM so that i can see 

 

a, the script 

b. the command-line and 

c. the output!?  .... which means - the output of the little bs4-script...

 

 

love to hear from you.. 

regards tarifa

 

 

image.thumb.png.310e2d36e76c815adffb3466cf2f62be.png

  • 0

hello dear DaveLegg hello dear fellows, 

 

 

above all. well i hope you and your family is well - and all goes well in your location. How is your town dealing with covit19? I hope that we can overcome this crisis soon. 

 

ad i get continued messages and as i encounter issues day by day i just add the findings here - perhaps we can solve them in this thread.  many many thanks to you and for any and all help. 

 

the topic of today: no kernel for grammar Python found - pykernel necessary - honestly?

 

well this is pretty confusing - i can run scripts - even in python. 

but after installing hydrogen  ( cf https://atom.io/packages/hydrogen ) i have encountered funny and very confusing things. 

i want to run a little python script - and while doing a test with hydrogen>run i get back the following message: 

 

see: 

No Kernels Installed
No kernels are installed on your system so you will not be able to execute code in any language.

 

(#)[Popular Kernels](#)[All Kernels](#)

No kernel for grammar  `Python`  found

 

Check that the language for this file is set in Atom, that you have a Jupyter kernel installed for it, and that you have configured the language mapping in Hydrogen preferences.

To detect your current Python install you will need to run:

    python -m pip install ipykernel
    python -m ipykernel install --user

 

Dave - well - what is pretty confusing  - is the fact that i can run scripts - also python scripts - with the package called script: they work pretty well ... 

what goes on here - i have no glue ... see the image: 

 

 image.thumb.png.5ec325b5ab931dfb061b0bba00284d87.png

 

look forward to hear from you 

 

regards

  • 0

 

 

update: well - i guess that Hydrogen requires more than a plain Python interpreter. It provides functionality much like a Jupyter Notebook.

 

If all i  want to do is run a small script, then I guess i should  just stick to the script package, or run it in a terminal.

 

but i want to see the output of the script - this is pretty important to me. 

 

 

  • 0

hi there - well i guess that there are still some packages missing on my machine. 

 

 

see the next trial

 

from bs4 import BeautifulSoup
URL = "https://www.worldometers.info/coronavirus/"
r = requests.get(URL)
soup = BeautifulSoup(r.content, 'html5lib')
countHTML = soup.find('divttrs = {'class':'content-inner'})

for countVar in countHTML.findAll('div', attrs = {'class':'maincounter-number'}):
    count = countVar.span

 

    

    

    - i get back the following result: 

 

 

Traceback (most recent call last):   File "/tmp/atom_script_tempfiles/0c9e3b30-6d27-11ea-84a4-095d4171334a", line 2, in <module>     worldometers.info NameError: name 'worldometers' is not defined [Finished in 0.069s]


 

   

i am on MX-Linux on Atom and i do not know why i get this back!? 

 

i guess that there is something wrong

 

i have to digg deeper what goes on here. 

 

 

see the next trial

 

 

import csv
import requests
from bs4 import BeautifulSoup

URL = "https://www.passiton.com/inspirational-quotes?page={}"

quotes = []
page = 1

while True:
    r = requests.get(URL.format(page))
    print(r.url)
    soup = BeautifulSoup(r.content, 'html5lib')

    if not soup.select_one("#all_quotes .text-center > a"):break
    for row in soup.select("#all_quotes .text-center"):
        quote = {}
        try:
            quote['quote'] = row.select_one('a img.shadow').get("alt")
        except AttributeError: quote['quote'] = ""
        try:
            quote['url'] = row.select_one('a').get('href')
        except AttributeError: quote['url'] = ""
        try:
            quote['img'] = row.select_one('a img.shadow').get('src')
        except AttributeError: quote['img'] = ""
        quotes.append(quote)

    page+=1

 

 

 

i runned this and i got back the following result: 

 

 

´https://www.passiton.com/inspirational-quotes?page=1
https://www.passiton.com/inspirational-quotes?page=2..
https://www.passiton.com/inspirational-quotes?page=n..
https://www.passiton.com/inspirational-quotes?page=44´

 

and besides that ´

 

 

Traceback (most recent call last):
  File "/home/martin/.atom/python/examples/bs_values_com.py", line 31, in <module>
    with open('inspirational_quotes.csv', 'w', newline="", encoding="utf-8") as f:
TypeError: file() takes at most 3 arguments (4 given)
[Finished in 55.861s]


cf https://stackoverflow.com/questions/60796795/web-scraping-in-python-with-beautifulsoup


i am just musing how and why i receive this. i am trying to figure it out. 
any help greatly appreciated. greetings

    

   

 

dear fellows  - i look forward to hear from you - i must figure out what goes on here.

 

Edited by tarifa
  • 0

dear Davelegg dear fellows, 

 

 

first of all - i hope that you are all well and all goes okay 

 

since it seems to belong all to the same issue and the same thing i add this to this thread. 

 

 


the question today is: How can we install the Python package other than using pip?th

 

 

i run Python on MX-Linux  - there is

 

 

root@mx:/home/martin# python3 --V
unknown option --V
usage: python3 [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.
root@mx:/home/martin# python3 -V
Python 3.7.3
root@mx:/home/martin# pip install pandas
bash: pip: command not found.

 

i have no pip on the machine:  if i want to install pandas with the following command it does not work

 

pip install pandas

 

 

well i guess that i first of all need to instal pip

 

  Quote

1) Find the package at PyPI - the Python Package Index .


2) Download the source code,
3) Read the INSTALL.txt or README.txt for clue on installation.
4) Usually installation is made of these steps
     $ python setup.py   build
     $ python setup.py  install
Expand  

 

If you do not have EasyBuild installed yet, or if you just want to install the most recent version of each of the EasyBuild packages, you can use one of the following simple commands:

 

using easy_install (old tool, but still works):

 

easy_install --prefix $HOME/EasyBuild easybuild

 

Note If we already have easybuild installed, we may need to instruct easy_install to install a newer version, using --upgrade or -U.

 

using pip (more recent and better installation tool for Python software):

 

pip install --install-option "--prefix=$HOME/EasyBuild" easybuild

The --prefix $HOME/EasyBuild part in these commands allows you to install EasyBuild without admin rights into $HOME/EasyBuild.

 

 

Note For pip v8.0 and newer, pip install --prefix=$HOME/EasyBuild easybuild works too.

 

but wait: this page tells us that pip should be no my machine: 

pip is already installed if you are using Python 2 >=2.7.9 or Python 3 >=3.4 downloaded from python.org or if you are working in a Virtual Environment created by virtualenv or pyvenv. Just make sure to upgrade pip.

 

Installing with get-pip.py To install pip, securely   download get-pip.py by following this link: get-pip.py. Alternatively, use curl:

 

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

 

Then run the following command in the folder where you have downloaded get-pip.py:

 

python get-pip.py

Warning Be cautious if you are using a Python install that is managed by your operating system or another package manager. get-pip.py does not coordinate with those tools, and may leave your system in an inconsistent state.

 

so after all i am a bit confused: what  should i do - if i want to install pandas

- the questions are:

- wich options do i have to install pandas without pip 
- besides that: am i able to install pip with a simple method without running into any troubles?!?
- what should i do have to look for the preliminary steps!?
- are there any stepstones or pitfalls here !?

 

 

Dear Davelegg - sorry for adding this also to the thread - but i guess that this is quite helpful since it belongs to the same area of scope and interest. 


love to hear from you

 

 

regards 

  • 0

hi there good day 

 

i gathered more insights:  note i run the following code on MX-Linux version 19.1 (where Python runs in Version 3.7.xy) with a fresh installation of ATOM - 


cf: https://stackoverflow.com/questions/60908216/how-to-handle-multiple-urls-in-beautifultsoup-and-convert-the-data-into-datafram


 

    import requests
    from bs4 import BeautifulSoup
    import pandas as pd


    def Main(urls):
        with requests.Session() as req:
            allin = []
            for url in urls:
                r = req.get(url)
                soup = BeautifulSoup(r.content, 'html.parser')
                target = soup.find(
                    "dl", class_="c-description-list c-description-list--striped")
                names = [item.text for item in target.findAll("dt")]
                names.append("url")
                data = [item.get_text(strip=True) for item in target.findAll("dd")]
                data.append(url)
                allin.append(data)
            df = pd.DataFrame(allin, columns=names)
            df.to_csv("data.csv", index=False, encoding="utf-8")


    urls = ['https://www2.daad.de/deutschland/studienangebote/international-programmes/en/detail/4722/',
            'https://www2.daad.de/deutschland/studienangebote/international-programmes/en/detail/6318/']
    Main(urls)

 


question - how to find out where the script stores the results - the csv-file. 

can i set the paths in ATOM some how some way - are there some options to do this!?


btw:  very interesting without the encoding = "utf-8" in the line   df.to_csv("data.csv", index=False, encoding="utf-8") i have errors since ihave UnicodeEncodeError, seems that my system default encoding isn't utf-8, therefor, 



guessing:  i guess that i set up the machine /ATOM badly … - any and all help greatly appreciated. - 

 

 

    Traceback (most recent call last):
      File "/home/martin/dev/python/daad_studienangebote_url_liste.py", line 25, in <module>
        Main(urls)
      File "/home/martin/dev/python/daad_studienangebote_url_liste.py", line 20, in Main
        df.to_csv("data.csv", index=False)
      File "/usr/local/lib/python2.7/dist-packages/pandas/core/generic.py", line 3020, in to_csv
        formatter.save()
      File "/usr/local/lib/python2.7/dist-packages/pandas/io/formats/csvs.py", line 172, in save
        self._save()
      File "/usr/local/lib/python2.7/dist-packages/pandas/io/formats/csvs.py", line 288, in _save
        self._save_chunk(start_i, end_i)
      File "/usr/local/lib/python2.7/dist-packages/pandas/io/formats/csvs.py", line 315, in _save_chunk
        self.cols, self.writer)
      File "pandas/_libs/writers.pyx", line 75, in pandas._libs.writers.write_csv_rows
    UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 39: ordinal not in range(128)
    [Finished in 3.134s]

 

 

with the correct encoding the script runs very well python - daad_studienangebote_url_liste.py:21

 

i get back this result in the ATOM -.. 
 

`[Finished in 5.461s]`

 

but there remain two little questions: 

 

a. how ot set the default encoding in ATOM !? 
b. how - and where set the paths in ATOM !? 


love to hear from you 

  • 0

Dear fellows,

 

Regarding the issues: 

 

a. how ot set the default encoding in ATOM !? 
b. how - and where set the paths in ATOM !? 

 

i will digg deeper into all that

 

 

for a. i guess that the solution will be this here - a solver for the default encoding.

atom-default-encoding package:

 

 

atom-default-encoding package

 

see the link: https://atom.io/packages/default-encoding

 

image.thumb.png.d1ed03f32606ad6da0aeb58b6f35740e.png

 

what it does: Specify default encodings in config for a specific scope selector. If no config default is found, try to autodetect encoding.

 

 

 

for b. regarding the setup of python in Atom - and for the question of where the system saves the data - i found out this - hope this may help others too:

 

 

 

above all  - stay healthy - and all the best to  you both!!! 

 

have a great day.

Edited by tarifa

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Wonder if the HDMI Forum will allow AMD to use HDMI 2.2 under Linux.
    • Where did you hear visio is discontinued? It's still available and being updated on Office 365 and even has an online free version now too
    • PC gaming is stalling as well, recent analyst post I read is that it will stall for at least two years because of prices, tariffs and AI demand impacting GPU cost and availability. So far the only console to go up in price has been the Xbox. Which IMHO is just part of Microsoft’s plans to get out of the traditional insole market and move to a “Xbox” console that is just a PC made by an OEM with a Xbox sticker on it.
    • Jumping unicorns means people initiate Nintendo gaming
    • KB5060829: Microsoft makes Windows 11 File Explorer, Search faster with Build 26100.4482 by Sayan Sen Microsoft has released a new Release Preview build for Windows 11 Insiders. The new build, 26100.4482, under KB5060829, improves the performance of the File Explorer in case of extracting archives. The company says "has been enhanced when extracting archive files" and that the improvement will mainly be felt "in the case of copy pasting large numbers of files out of large 7z or .rar archives." Aside from File Explorer, Microsoft says that users can also expect a snappier Search. Microsoft notes that earlier the feature would respond "very slowly—the Search Box can take over 10 seconds to load before you can use it." Besides those, Taskbar has also received an improvement as it will better use the available real estate space more effectively with new ability to resize icons so more apps can fit. The build also brings new PC Migration tool. Start menu pins have also changed You can view the full changelog below: Gradual rollout [App defaults] New! We are rolling out some small changes in the EEA region for default browsers via the Set default button in Settings > Apps > Default apps: Additional file and link types will be set for the new default browser, if it registers them. The new default browser will be pinned to the Taskbar and Start menu unless you choose not to pin it by clearing the checkboxes. There is now a separate one-click button for browsers to change your .pdf default, if the browser registers for the .pdf file type. [Start menu] New! For Admins, the Configure Start Pins policy now includes an option to apply Start menu pins only once. This means users will receive the admin Start menu pins on their first sign-in (day 0), but afterward, they can personalize their pinned layout, and those changes will be retained. This policy can also be applied through group policy, in addition to the existing configuration service provider (CSP) method. [Taskbar & System Tray] New! The taskbar now resizes icons to fit more apps when space runs low, keeping everything visible and easy to access. You can adjust how icons appear in settings—reduce icon size only when the taskbar is full (default), keep icons at their original size at all times by selecting Never, or use smaller icons all the time by selecting Always. To change this setting, right-click an empty area on the taskbar, select Taskbar settings, expand the Taskbar behaviors section, and choose your preference under Show smaller taskbar buttons. New! In addition to the new grouping of the Accessibility menu in Quick settings, there are text descriptions for the assistive technologies like Narrator, Voice access, and more for easier identification and learning. New! Adjusted the indicator (pill) under taskbar apps to make it wider and more visible. Fixed: Clicking the top third of the buttons in the top row doesn’t work to enable or disable the button. Fixed: WIN + CTRL + Number doesn’t work anymore for switching windows of an open app in the taskbar Fixed: When using taskbar in Windows, the media controls that appear in the preview windows for apps might unexpectedly flicker. [Windows Share] New! When you share links or web content using the Windows share window, you will see a visual preview for that content. New! In the Windows share window, you can select a compression level—High, Medium, or Low Quality—when editing and sharing images, instead of selecting from a 0–100 scale. [PC Migration] We’re beginning the rollout of a new PC-to-PC migration experience in Windows. You’ll start to see the landing and the pairing page in the Windows Backup app, giving you a first look at what’s coming. In the full experience, you will be able to transfer your files and settings from your old PC to the new one during the PC setup process. Support during the PC setup will be available in a future update. We are releasing in phases for a smooth experience and will provide more details soon. [File Explorer] Improved: Performance has been enhanced when extracting archive files – this will particularly help in the case of copy pasting large numbers of files out of large 7z or .rar archives. Narrator New! The Screen Curtain feature in Narrator helps protect your privacy and improve focus by blacking out the screen while Narrator reads content aloud. This is especially helpful in public or shared spaces, where you can work with sensitive information without others seeing your screen. To turn on Narrator, press Ctrl + Windows + Enter. Then press Caps Lock + Ctrl + C to enable Screen Curtain. While it’s on, you can use Narrator as usual with the screen hidden. Press Caps Lock + Ctrl + C again to turn it off. New! Narrator makes it easier to discover and learn about its features directly within the experience. Whether you’re new or exploring advanced options, Narrator will guide you through the latest updates using a series of steps and prompts that explain each new feature and change. [Voice Access] New! You can now use voice access to navigate, dictate, and interact with Windows using voice commands in Simplified Chinese and Traditional Chinese. New! You can add custom words to the dictionary in voice access. The feature will be available in all the currently supported voice access languages. [Settings] New! The Settings homepage on PCs managed by IT administrators now includes cards tailored for enterprise use. These include familiar options like “Recommended settings” and “Bluetooth devices,” along with two cards for device info and accessibility preferences. If a user signs in with both a work or school account and a Microsoft account, an additional accounts card appears to show both account types. New! Added the country or region selected during device setup under Settings > Time & language > Language & region. Fixed: The storage card in Settings > System > About shows an incorrect or unreadable character instead of the proper disk size. [Windowing] Fixed: When you ALT + Tab out of a full screen game, other windows (like Windows Terminal might stop responding. Fixed: An underlying issue might lead to unexpected window size and position changes after sleep/resume for some devices. Fixed: Explorer.exe might stop working unexpectedly when dragging a window if window snapping is enabled. [Scripting] Fixed: Running a script on a remote SMB share might take an unexpectedly long time if the share was an older Windows Server version like Windows Server 2019. [Graphics] Improved: Made some underlying changes to help improve display related user experiences, including reducing screen flashing in some display configuration transitions and removing unnecessary display resets which was happening in some cases. Fixed: Certain displays might be unexpectedly green. Fixed: If User Account Control (UAC) is set to Always Notify and the button under Settings > System > Display for color calibration is selected for your display and canceled, Settings will stop responding. [Color Filters] Improved: Adjusted the location of the intensity and color boost sliders under Settings > Accessibility > Color Filters, so the color previews at the top of the page are visible while adjusting the sliders. [Input] Fixed: Typing Japanese with the touch keyboard may stop working after switching to typing with an English keyboard and back. [Printing] Fixed: Printed lines might be unexpectedly thicker than expected. [MSFTEdit.dll] Fixed: Some apps like Sticky Notes and dxdiag might stop working when the display language is set to Arabic or Hebrew. Normal rollout [Copilot] Fixed: Improved the Copilot key’s reliability and resolved an issue that prevented users from restarting Copilot after using the key. [Performance] Fixed: This update addresses an issue to maintain efficiency of Storage Spaces Direct (S2D). When running complex software defined data center (SDDC) related workflows, it’s possible the system might become unresponsive. [Storage optimization] Fixed: An issue that prevented unused language packs and Feature on Demand packages from being fully removed, which led to unnecessary storage use and longer Windows Update installation times. [Windows Search] Fixed: Windows Search responds very slowly—the Search Box can take over 10 seconds to load before you can use it. Fixed: This update enhances the reliability of Windows Search and resolves an issue that prevented users from typing in Windows Search in some cases. You can find the official blog post here on Microsoft's website.
  • Recent Achievements

    • Week One Done
      Wayne Robinson earned a badge
      Week One Done
    • One Month Later
      Karan Khanna earned a badge
      One Month Later
    • Week One Done
      Karan Khanna earned a badge
      Week One Done
    • First Post
      MikeK13 earned a badge
      First Post
    • Week One Done
      OHI Accounting earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      690
    2. 2
      ATLien_0
      264
    3. 3
      Michael Scrip
      201
    4. 4
      +FloatingFatMan
      167
    5. 5
      Steven P.
      137
  • Tell a friend

    Love Neowin? Tell a friend!