Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python coding in Spyder IDE
#1
Hey Guys,
I'm a coding beginner. I had some C# and C++ in school and I want to try python for some smaller projects.
I did not learn how to work with virtual envs, version management, site-packages and all that stuff so I try to become familiar with that also. Confused

After a few hours on Youtube I was able to install anaconda and create envs for my first projects. As IDE I use Spyder.
Here things happens that I do not understand.

First I wanted to find out how logging works because it will help me dealing with problems in the future. I used the examples to try this out and this works perfectly.

import logging
from datetime import datetime

logging.basicConfig(filename='example.log', level=logging.DEBUG)
now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
logging.debug(now + ": " + 'debugging information')
My projects will have more than 1 file. This is why I want to create for each 'programname.py' a related log file called 'programname.log'.

To do so I changed the 'example.log' to 'programname.log' in my code.
But new informations are still written into 'example.log'. Even when I copy and execute my code to a new program no 'programname.log' file will be created.

After that I activated my env in a linux terminal and I run my code from there. Python creates my 'programname.log' file and write my informations in there. Dance

It's not directly a coding question, but do someone know why this is not working in Spyder IDE? Huh
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How can I make a short-key in Spyder (Python IDE)? moose 3 2,692 Nov-02-2020, 12:13 PM
Last Post: jefsummers
  How can I scroll over my data points when creating plots in Python? (I'm using Spyder moose 0 1,613 Nov-02-2020, 07:18 AM
Last Post: moose
  python variable issues - using spyder and opencv Afrodizzyjack 5 5,818 Jun-19-2018, 09:46 AM
Last Post: gontajones
  Python-Spyder error opening integrak20 0 3,668 Oct-20-2017, 05:44 AM
Last Post: integrak20
  Issue in launching spyder that was installed using pip install on Python 3.6.1 python300 6 11,066 Jun-02-2017, 10:44 PM
Last Post: python300
  How to add python library to Spyder awa5114 4 62,574 Apr-29-2017, 04:19 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020